zahmis 4 years ago
parent
commit
29a5324f39

+ 1 - 1
packages/app/src/server/models/index.js

@@ -16,7 +16,7 @@ module.exports = {
   GlobalNotificationMailSetting: require('./GlobalNotificationSetting/GlobalNotificationMailSetting'),
   GlobalNotificationMailSetting: require('./GlobalNotificationSetting/GlobalNotificationMailSetting'),
   GlobalNotificationSlackSetting: require('./GlobalNotificationSetting/GlobalNotificationSlackSetting'),
   GlobalNotificationSlackSetting: require('./GlobalNotificationSetting/GlobalNotificationSlackSetting'),
   ShareLink: require('./share-link'),
   ShareLink: require('./share-link'),
-  SlackAppIntegration: require('./slack-app-integration'),
+  // SlackAppIntegration: require('./slack-app-integration'),
   // MOCK DATA DELETE THIS GW-6972 ---------------
   // MOCK DATA DELETE THIS GW-6972 ---------------
   SlackAppIntegrationMock: require('./slack-app-integration-mock'),
   SlackAppIntegrationMock: require('./slack-app-integration-mock'),
   // MOCK DATA DELETE THIS GW-6972 ---------------
   // MOCK DATA DELETE THIS GW-6972 ---------------

+ 42 - 42
packages/app/src/server/models/slack-app-integration.js

@@ -1,55 +1,55 @@
-const crypto = require('crypto');
-const mongoose = require('mongoose');
+// const crypto = require('crypto');
+// const mongoose = require('mongoose');
 
 
-const schema = new mongoose.Schema({
-  tokenGtoP: { type: String, required: true, unique: true },
-  tokenPtoG: { type: String, required: true, unique: true },
-  isPrimary: { type: Boolean, unique: true, sparse: true },
-  supportedCommandsForBroadcastUse: { type: [String], default: [] },
-  supportedCommandsForSingleUse: { type: [String], default: [] },
-});
+// const schema = new mongoose.Schema({
+//   tokenGtoP: { type: String, required: true, unique: true },
+//   tokenPtoG: { type: String, required: true, unique: true },
+//   isPrimary: { type: Boolean, unique: true, sparse: true },
+//   supportedCommandsForBroadcastUse: { type: [String], default: [] },
+//   supportedCommandsForSingleUse: { type: [String], default: [] },
+// });
 
 
-class SlackAppIntegration {
+// class SlackAppIntegration {
 
 
-  crowi;
+//   crowi;
 
 
-  static generateAccessTokens(saltForGtoP, saltForPtoG) {
-    const now = new Date().getTime();
-    const hasher1 = crypto.createHash('sha512');
-    const hasher2 = crypto.createHash('sha512');
-    const tokenGtoP = hasher1.update(`gtop-${saltForGtoP}-${now.toString()}`).digest('base64');
-    const tokenPtoG = hasher2.update(`ptog-${saltForPtoG}-${now.toString()}`).digest('base64');
-    return [tokenGtoP, tokenPtoG];
-  }
+//   static generateAccessTokens(saltForGtoP, saltForPtoG) {
+//     const now = new Date().getTime();
+//     const hasher1 = crypto.createHash('sha512');
+//     const hasher2 = crypto.createHash('sha512');
+//     const tokenGtoP = hasher1.update(`gtop-${saltForGtoP}-${now.toString()}`).digest('base64');
+//     const tokenPtoG = hasher2.update(`ptog-${saltForPtoG}-${now.toString()}`).digest('base64');
+//     return [tokenGtoP, tokenPtoG];
+//   }
 
 
-  static async generateUniqueAccessTokens() {
-    let duplicateTokens;
-    let tokenGtoP;
-    let tokenPtoG;
-    let generateTokens;
+//   static async generateUniqueAccessTokens() {
+//     let duplicateTokens;
+//     let tokenGtoP;
+//     let tokenPtoG;
+//     let generateTokens;
 
 
-    // get salt strings
-    const saltForGtoP = this.crowi.configManager.getConfig('crowi', 'slackbot:withProxy:saltForGtoP');
-    const saltForPtoG = this.crowi.configManager.getConfig('crowi', 'slackbot:withProxy:saltForPtoG');
+//     // get salt strings
+//     const saltForGtoP = this.crowi.configManager.getConfig('crowi', 'slackbot:withProxy:saltForGtoP');
+//     const saltForPtoG = this.crowi.configManager.getConfig('crowi', 'slackbot:withProxy:saltForPtoG');
 
 
-    do {
-      generateTokens = this.generateAccessTokens(saltForGtoP, saltForPtoG);
-      tokenGtoP = generateTokens[0];
-      tokenPtoG = generateTokens[1];
-      // eslint-disable-next-line no-await-in-loop
-      duplicateTokens = await this.findOne({ $or: [{ tokenGtoP }, { tokenPtoG }] });
-    } while (duplicateTokens != null);
+//     do {
+//       generateTokens = this.generateAccessTokens(saltForGtoP, saltForPtoG);
+//       tokenGtoP = generateTokens[0];
+//       tokenPtoG = generateTokens[1];
+//       // eslint-disable-next-line no-await-in-loop
+//       duplicateTokens = await this.findOne({ $or: [{ tokenGtoP }, { tokenPtoG }] });
+//     } while (duplicateTokens != null);
 
 
 
 
-    return { tokenGtoP, tokenPtoG };
-  }
+//     return { tokenGtoP, tokenPtoG };
+//   }
 
 
-}
+// }
 
 
-module.exports = function(crowi) {
+// module.exports = function(crowi) {
 
 
-  SlackAppIntegration.crowi = crowi;
+//   SlackAppIntegration.crowi = crowi;
 
 
-  schema.loadClass(SlackAppIntegration);
-  return mongoose.model('SlackAppIntegration', schema);
-};
+//   schema.loadClass(SlackAppIntegration);
+//   return mongoose.model('SlackAppIntegration', schema);
+// };

+ 23 - 18
packages/app/src/server/routes/apiv3/slack-integration-settings.js

@@ -56,7 +56,6 @@ module.exports = (crowi) => {
   const csrf = require('../../middlewares/csrf')(crowi);
   const csrf = require('../../middlewares/csrf')(crowi);
   const apiV3FormValidator = require('../../middlewares/apiv3-form-validator')(crowi);
   const apiV3FormValidator = require('../../middlewares/apiv3-form-validator')(crowi);
 
 
-  const SlackAppIntegration = mongoose.model('SlackAppIntegration');
   const SlackAppIntegrationMock = mongoose.model('SlackAppIntegrationMock');
   const SlackAppIntegrationMock = mongoose.model('SlackAppIntegrationMock');
 
 
   const validator = {
   const validator = {
@@ -102,7 +101,7 @@ module.exports = (crowi) => {
   }
   }
 
 
   async function resetAllBotSettings(initializedType) {
   async function resetAllBotSettings(initializedType) {
-    await SlackAppIntegration.deleteMany();
+    await SlackAppIntegrationMock.deleteMany();
 
 
     const params = {
     const params = {
       'slackbot:currentBotType': initializedType,
       'slackbot:currentBotType': initializedType,
@@ -139,6 +138,7 @@ module.exports = (crowi) => {
       throw new Error('Proxy URL is not registered');
       throw new Error('Proxy URL is not registered');
     }
     }
 
 
+    console.log(method);
     try {
     try {
       const result = await axios[method](
       const result = await axios[method](
         urljoin(proxyUri, endpoint),
         urljoin(proxyUri, endpoint),
@@ -211,11 +211,11 @@ module.exports = (crowi) => {
     }
     }
     else {
     else {
       try {
       try {
-        const slackAppIntegrations = await SlackAppIntegration.find();
+        const slackAppIntegrations = await SlackAppIntegrationMock.find();
         settings.slackAppIntegrations = slackAppIntegrations;
         settings.slackAppIntegrations = slackAppIntegrations;
       }
       }
       catch (e) {
       catch (e) {
-        errorMsg = 'Error occured in finding SlackAppIntegration entities.';
+        errorMsg = 'Error occured in finding SlackAppIntegrationMock entities.';
         errorCode = 'get-slackappintegration-failed';
         errorCode = 'get-slackappintegration-failed';
         logger.error(errorMsg, e);
         logger.error(errorMsg, e);
       }
       }
@@ -378,7 +378,7 @@ module.exports = (crowi) => {
    *          200:
    *          200:
    *            description: Succeeded to create slack app integration
    *            description: Succeeded to create slack app integration
    */
    */
-  router.put('/slack-app-integrations', loginRequiredStrictly, adminRequired, csrf, async(req, res) => {
+  router.post('/slack-app-integrations', loginRequiredStrictly, adminRequired, csrf, async(req, res) => {
     const SlackAppIntegrationMock = mongoose.model('SlackAppIntegrationMock');
     const SlackAppIntegrationMock = mongoose.model('SlackAppIntegrationMock');
     const SlackAppIntegrationMockRecordsNum = await SlackAppIntegrationMock.countDocuments();
     const SlackAppIntegrationMockRecordsNum = await SlackAppIntegrationMock.countDocuments();
     if (SlackAppIntegrationMockRecordsNum >= 10) {
     if (SlackAppIntegrationMockRecordsNum >= 10) {
@@ -390,7 +390,7 @@ module.exports = (crowi) => {
     const { tokenGtoP, tokenPtoG } = await SlackAppIntegrationMock.generateUniqueAccessTokens();
     const { tokenGtoP, tokenPtoG } = await SlackAppIntegrationMock.generateUniqueAccessTokens();
     try {
     try {
       // MOCK DATA DELETE THIS GW-6972 ---------------
       // MOCK DATA DELETE THIS GW-6972 ---------------
-      /* This code represents the creation of the new SlackAppIntegration model instance. */
+      /* This code represents the creation of the new SlackAppIntegrationMock model instance. */
       const initialSupportedCommandsForBroadcastUse = new Map();
       const initialSupportedCommandsForBroadcastUse = new Map();
       const initialSupportedCommandsForSingleUse = new Map();
       const initialSupportedCommandsForSingleUse = new Map();
       defaultSupportedCommandsNameForBroadcastUse.forEach((commandName) => {
       defaultSupportedCommandsNameForBroadcastUse.forEach((commandName) => {
@@ -429,16 +429,16 @@ module.exports = (crowi) => {
    *            description: Succeeded to delete access tokens for slack
    *            description: Succeeded to delete access tokens for slack
    */
    */
   router.delete('/slack-app-integrations/:id', validator.deleteIntegration, apiV3FormValidator, async(req, res) => {
   router.delete('/slack-app-integrations/:id', validator.deleteIntegration, apiV3FormValidator, async(req, res) => {
-    const SlackAppIntegration = mongoose.model('SlackAppIntegration');
+    const SlackAppIntegrationMock = mongoose.model('SlackAppIntegrationMock');
     const { id } = req.params;
     const { id } = req.params;
 
 
     try {
     try {
-      const response = await SlackAppIntegration.findOneAndDelete({ _id: id });
+      const response = await SlackAppIntegrationMock.findOneAndDelete({ _id: id });
 
 
       // update primary
       // update primary
-      const countOfPrimary = await SlackAppIntegration.countDocuments({ isPrimary: true });
+      const countOfPrimary = await SlackAppIntegrationMock.countDocuments({ isPrimary: true });
       if (countOfPrimary === 0) {
       if (countOfPrimary === 0) {
-        await SlackAppIntegration.updateOne({}, { isPrimary: true });
+        await SlackAppIntegrationMock.updateOne({}, { isPrimary: true });
       }
       }
 
 
       return res.apiv3({ response });
       return res.apiv3({ response });
@@ -463,7 +463,7 @@ module.exports = (crowi) => {
     catch (error) {
     catch (error) {
       const msg = 'Error occured in updating Custom bot setting';
       const msg = 'Error occured in updating Custom bot setting';
       logger.error('Error', error);
       logger.error('Error', error);
-      return res.apiv3Err(new ErrorV3(msg, 'delete-SlackAppIntegration-failed'), 500);
+      return res.apiv3Err(new ErrorV3(msg, 'delete-SlackAppIntegrationMock-failed'), 500);
     }
     }
 
 
   });
   });
@@ -487,7 +487,7 @@ module.exports = (crowi) => {
     const { id } = req.params;
     const { id } = req.params;
 
 
     try {
     try {
-      await SlackAppIntegration.bulkWrite([
+      await SlackAppIntegrationMock.bulkWrite([
         // unset isPrimary for others
         // unset isPrimary for others
         {
         {
           updateMany: {
           updateMany: {
@@ -507,7 +507,7 @@ module.exports = (crowi) => {
       return res.apiv3();
       return res.apiv3();
     }
     }
     catch (error) {
     catch (error) {
-      const msg = 'Error occurred during making SlackAppIntegration primary';
+      const msg = 'Error occurred during making SlackAppIntegrationMock primary';
       logger.error('Error', error);
       logger.error('Error', error);
       return res.apiv3Err(new ErrorV3(msg, 'making-primary-failed'), 500);
       return res.apiv3Err(new ErrorV3(msg, 'making-primary-failed'), 500);
     }
     }
@@ -532,8 +532,8 @@ module.exports = (crowi) => {
     const { id } = req.params;
     const { id } = req.params;
 
 
     try {
     try {
-      const { tokenGtoP, tokenPtoG } = await SlackAppIntegration.generateUniqueAccessTokens();
-      const slackAppTokens = await SlackAppIntegration.findByIdAndUpdate(id, { tokenGtoP, tokenPtoG });
+      const { tokenGtoP, tokenPtoG } = await SlackAppIntegrationMock.generateUniqueAccessTokens();
+      const slackAppTokens = await SlackAppIntegrationMock.findByIdAndUpdate(id, { tokenGtoP, tokenPtoG });
 
 
       return res.apiv3(slackAppTokens, 200);
       return res.apiv3(slackAppTokens, 200);
     }
     }
@@ -562,9 +562,11 @@ module.exports = (crowi) => {
     const { supportedCommandsForBroadcastUse, supportedCommandsForSingleUse } = req.body;
     const { supportedCommandsForBroadcastUse, supportedCommandsForSingleUse } = req.body;
     const { id } = req.params;
     const { id } = req.params;
 
 
+    const SlackAppIntegrationMock = mongoose.model('SlackAppIntegrationMock');
+
     try {
     try {
       // NOT MOCK DATA BUT REFER THIS GW-7006
       // NOT MOCK DATA BUT REFER THIS GW-7006
-      const slackAppIntegration = await SlackAppIntegration.findByIdAndUpdate(
+      const slackAppIntegration = await SlackAppIntegrationMock.findByIdAndUpdate(
         id,
         id,
         { supportedCommandsForBroadcastUse, supportedCommandsForSingleUse },
         { supportedCommandsForBroadcastUse, supportedCommandsForSingleUse },
         { new: true },
         { new: true },
@@ -576,7 +578,6 @@ module.exports = (crowi) => {
        * , then send request to proxy to update cache
        * , then send request to proxy to update cache
        * permittedChannelsForEachCommandFromClient represents the data sent from client
        * permittedChannelsForEachCommandFromClient represents the data sent from client
        */
        */
-      const SlackAppIntegrationMock = mongoose.model('SlackAppIntegrationMock');
       // MOCK DATA FROM CLIENT assume that these data were sent from client
       // MOCK DATA FROM CLIENT assume that these data were sent from client
       const permissionsForBroadcastUseCommandsFromClient = {
       const permissionsForBroadcastUseCommandsFromClient = {
         search: false,
         search: false,
@@ -648,11 +649,14 @@ module.exports = (crowi) => {
       const slackAppIntegrationMock = await SlackAppIntegrationMock.findOne({ _id: id });
       const slackAppIntegrationMock = await SlackAppIntegrationMock.findOne({ _id: id });
       // MOCK DATA DELETE THIS GW-6972 ---------------
       // MOCK DATA DELETE THIS GW-6972 ---------------
       if (slackAppIntegrationMock == null) {
       if (slackAppIntegrationMock == null) {
-        const msg = 'Could not find SlackAppIntegration by id';
+        const msg = 'Could not find SlackAppIntegrationMock by id';
         return res.apiv3Err(new ErrorV3(msg, 'find-slackAppIntegration-failed'), 400);
         return res.apiv3Err(new ErrorV3(msg, 'find-slackAppIntegration-failed'), 400);
       }
       }
 
 
       // USE MOCK DATA HERE FOR cache creation at /relation-test GW-7021
       // USE MOCK DATA HERE FOR cache creation at /relation-test GW-7021
+      console.log(slackAppIntegrationMock.tokenGtoP);
+      console.log(slackAppIntegrationMock.permissionsForBroadcastUseCommands);
+      console.log(slackAppIntegrationMock.permissionsForSingleUseCommands);
       const result = await requestToProxyServer(
       const result = await requestToProxyServer(
         slackAppIntegrationMock.tokenGtoP,
         slackAppIntegrationMock.tokenGtoP,
         'post',
         'post',
@@ -670,6 +674,7 @@ module.exports = (crowi) => {
       }
       }
     }
     }
     catch (error) {
     catch (error) {
+      console.log((673));
       logger.error('Error', error);
       logger.error('Error', error);
       return res.apiv3Err(new ErrorV3(`Error occured while testing. Cause: ${error.message}`, 'test-failed', error.stack));
       return res.apiv3Err(new ErrorV3(`Error occured while testing. Cause: ${error.message}`, 'test-failed', error.stack));
     }
     }

+ 1 - 2
packages/app/src/server/routes/apiv3/slack-integration.js

@@ -8,7 +8,6 @@ const { verifySlackRequest, generateWebClient, getSupportedGrowiActionsRegExps }
 
 
 const logger = loggerFactory('growi:routes:apiv3:slack-integration');
 const logger = loggerFactory('growi:routes:apiv3:slack-integration');
 const router = express.Router();
 const router = express.Router();
-const SlackAppIntegration = mongoose.model('SlackAppIntegrationMock');
 const SlackAppIntegrationMock = mongoose.model('SlackAppIntegrationMock');
 const SlackAppIntegrationMock = mongoose.model('SlackAppIntegrationMock');
 const { respondIfSlackbotError } = require('../../service/slack-command-handler/respond-if-slackbot-error');
 const { respondIfSlackbotError } = require('../../service/slack-command-handler/respond-if-slackbot-error');
 
 
@@ -169,7 +168,7 @@ module.exports = (crowi) => {
 
 
     const tokenPtoG = req.headers['x-growi-ptog-tokens'];
     const tokenPtoG = req.headers['x-growi-ptog-tokens'];
     const client = await slackIntegrationService.generateClientByTokenPtoG(tokenPtoG);
     const client = await slackIntegrationService.generateClientByTokenPtoG(tokenPtoG);
-
+    console.log(171);
     return handleCommands(req, res, client);
     return handleCommands(req, res, client);
   });
   });
 
 

+ 2 - 1
packages/app/src/server/service/slack-integration.ts

@@ -153,7 +153,7 @@ export class SlackIntegrationService implements S2sMessageHandlable {
     }
     }
 
 
     // retrieve primary SlackAppIntegration
     // retrieve primary SlackAppIntegration
-    const SlackAppIntegration = mongoose.model('SlackAppIntegration');
+    const SlackAppIntegration = mongoose.model('SlackAppIntegrationMock');
     const slackAppIntegration = await SlackAppIntegration.findOne({ isPrimary: true });
     const slackAppIntegration = await SlackAppIntegration.findOne({ isPrimary: true });
 
 
     if (slackAppIntegration == null) {
     if (slackAppIntegration == null) {
@@ -219,6 +219,7 @@ export class SlackIntegrationService implements S2sMessageHandlable {
   async handleCommandRequest(command, client, body, ...opt) {
   async handleCommandRequest(command, client, body, ...opt) {
     let module;
     let module;
     try {
     try {
+      console.log(command, 222);
       module = `./slack-command-handler/${command}`;
       module = `./slack-command-handler/${command}`;
     }
     }
     catch (err) {
     catch (err) {

+ 3 - 0
packages/slack/src/middlewares/verify-growi-to-slack-request.ts

@@ -12,6 +12,7 @@ const logger = loggerFactory('@growi/slack:middlewares:verify-growi-to-slack-req
  */
  */
 export const verifyGrowiToSlackRequest = (req: RequestFromGrowi, res: Response, next: NextFunction): Record<string, any> | void => {
 export const verifyGrowiToSlackRequest = (req: RequestFromGrowi, res: Response, next: NextFunction): Record<string, any> | void => {
   const str = req.headers['x-growi-gtop-tokens'];
   const str = req.headers['x-growi-gtop-tokens'];
+  console.log(str);
 
 
   if (str == null) {
   if (str == null) {
     const message = 'The value of header \'x-growi-gtop-tokens\' must not be empty.';
     const message = 'The value of header \'x-growi-gtop-tokens\' must not be empty.';
@@ -27,5 +28,7 @@ export const verifyGrowiToSlackRequest = (req: RequestFromGrowi, res: Response,
   }
   }
 
 
   req.tokenGtoPs = tokens;
   req.tokenGtoPs = tokens;
+  console.log(31);
+
   return next();
   return next();
 };
 };

+ 19 - 0
packages/slackbot-proxy/src/controllers/growi-to-slack.ts

@@ -52,6 +52,8 @@ export class GrowiToSlackCtrl {
   sectionBlockPayloadDelegator: SectionBlockPayloadDelegator;
   sectionBlockPayloadDelegator: SectionBlockPayloadDelegator;
 
 
   async requestToGrowi(growiUrl:string, tokenPtoG:string):Promise<void> {
   async requestToGrowi(growiUrl:string, tokenPtoG:string):Promise<void> {
+    console.log(55);
+
     const url = new URL('/_api/v3/slack-integration/proxied/commands', growiUrl);
     const url = new URL('/_api/v3/slack-integration/proxied/commands', growiUrl);
     await axios.post(url.toString(), {
     await axios.post(url.toString(), {
       type: 'url_verification',
       type: 'url_verification',
@@ -121,6 +123,8 @@ export class GrowiToSlackCtrl {
   @Post('/relation-test')
   @Post('/relation-test')
   @UseBefore(verifyGrowiToSlackRequest)
   @UseBefore(verifyGrowiToSlackRequest)
   async postRelation(@Req() req: GrowiReq, @Res() res: Res): Promise<void|string|Res|WebAPICallResult> {
   async postRelation(@Req() req: GrowiReq, @Res() res: Res): Promise<void|string|Res|WebAPICallResult> {
+    console.log(126);
+
     const { tokenGtoPs } = req;
     const { tokenGtoPs } = req;
 
 
     if (tokenGtoPs.length !== 1) {
     if (tokenGtoPs.length !== 1) {
@@ -130,16 +134,22 @@ export class GrowiToSlackCtrl {
     const tokenGtoP = tokenGtoPs[0];
     const tokenGtoP = tokenGtoPs[0];
 
 
     // retrieve relation with Installation
     // retrieve relation with Installation
+    console.log(tokenGtoP, 133);
+
     const relation = await this.relationRepository.createQueryBuilder('relation')
     const relation = await this.relationRepository.createQueryBuilder('relation')
       .where('tokenGtoP = :token', { token: tokenGtoP })
       .where('tokenGtoP = :token', { token: tokenGtoP })
       .leftJoinAndSelect('relation.installation', 'installation')
       .leftJoinAndSelect('relation.installation', 'installation')
       .getOne();
       .getOne();
 
 
+    console.log(138, relation);
+
     // Returns the result of the test if it already exists
     // Returns the result of the test if it already exists
     if (relation != null) {
     if (relation != null) {
       logger.debug('relation found', relation);
       logger.debug('relation found', relation);
 
 
       const token = relation.installation.data.bot?.token;
       const token = relation.installation.data.bot?.token;
+      console.log(token, 145);
+
       if (token == null) {
       if (token == null) {
         throw createError(400, 'installation is invalid');
         throw createError(400, 'installation is invalid');
       }
       }
@@ -148,11 +158,15 @@ export class GrowiToSlackCtrl {
         await this.requestToGrowi(relation.growiUri, relation.tokenPtoG);
         await this.requestToGrowi(relation.growiUri, relation.tokenPtoG);
       }
       }
       catch (err) {
       catch (err) {
+        console.log(157);
+
         logger.error(err);
         logger.error(err);
         throw createError(400, `failed to request to GROWI. err: ${err.message}`);
         throw createError(400, `failed to request to GROWI. err: ${err.message}`);
       }
       }
+      console.log(162);
 
 
       const status = await getConnectionStatus(token);
       const status = await getConnectionStatus(token);
+
       if (status.error != null) {
       if (status.error != null) {
         throw createError(400, `failed to get connection. err: ${status.error}`);
         throw createError(400, `failed to get connection. err: ${status.error}`);
       }
       }
@@ -167,6 +181,9 @@ export class GrowiToSlackCtrl {
       .leftJoinAndSelect('order.installation', 'installation')
       .leftJoinAndSelect('order.installation', 'installation')
       .getOne();
       .getOne();
 
 
+    console.log(order);// 存在する
+
+
     if (order == null || order.isExpired()) {
     if (order == null || order.isExpired()) {
       throw createError(400, 'order has expired or does not exist.');
       throw createError(400, 'order has expired or does not exist.');
     }
     }
@@ -176,6 +193,8 @@ export class GrowiToSlackCtrl {
       await this.requestToGrowi(order.growiUrl, order.tokenPtoG);
       await this.requestToGrowi(order.growiUrl, order.tokenPtoG);
     }
     }
     catch (err) {
     catch (err) {
+      console.log(192, err);
+
       logger.error(err);
       logger.error(err);
       throw createError(400, `failed to request to GROWI. err: ${err.message}`);
       throw createError(400, `failed to request to GROWI. err: ${err.message}`);
     }
     }