فهرست منبع

fix 500 error interactions

zahmis 4 سال پیش
والد
کامیت
8975968a4c
1فایلهای تغییر یافته به همراه6 افزوده شده و 6 حذف شده
  1. 6 6
      packages/slackbot-proxy/src/middlewares/slack-to-growi/authorizer.ts

+ 6 - 6
packages/slackbot-proxy/src/middlewares/slack-to-growi/authorizer.ts

@@ -82,6 +82,12 @@ export class AuthorizeInteractionMiddleware implements IMiddleware {
     async use(@Req() req: SlackOauthReq, @Res() res:Res): Promise<void|Res> {
       const { body } = req;
 
+      if (body.payload == null) {
+        // do nothing
+        this.logger.info('body does not have payload');
+        return;
+      }
+
       const payload = JSON.parse(body.payload);
 
       // extract id from body.payload
@@ -89,12 +95,6 @@ export class AuthorizeInteractionMiddleware implements IMiddleware {
       const enterpriseId = payload.enterprise?.id;
       const isEnterpriseInstall = payload.is_enterprise_install === 'true';
 
-      if (body.payload == null) {
-      // do nothing
-        this.logger.info('body does not have payload');
-        return;
-      }
-
       const query: InstallationQuery<boolean> = {
         teamId,
         enterpriseId,