File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
packages/integrations/src Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,10 @@ export async function slackWebhook(
186
186
return reply . status ( 400 ) . send ( { error : 'Invalid params' } ) ;
187
187
}
188
188
const slackInstaller = createSlackInstaller ( ) ;
189
+ if ( ! slackInstaller ) {
190
+ request . log . error ( 'Slack installer not found' ) ;
191
+ return reply . status ( 500 ) . send ( { error : 'Slack installer not found' } ) ;
192
+ }
189
193
190
194
const veryfiedState = await slackInstaller . stateStore ?. verifyStateParam (
191
195
new Date ( ) ,
Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ export const createSlackInstaller = () => {
8
8
const SLACK_CLIENT_ID = process . env . SLACK_CLIENT_ID ;
9
9
const SLACK_CLIENT_SECRET = process . env . SLACK_CLIENT_SECRET ;
10
10
const SLACK_STATE_SECRET = process . env . SLACK_STATE_SECRET ;
11
+ if ( ! SLACK_CLIENT_ID || ! SLACK_CLIENT_SECRET || ! SLACK_STATE_SECRET ) {
12
+ return null
13
+ }
11
14
const slackInstaller = new InstallProvider ( {
12
15
clientId : SLACK_CLIENT_ID ! ,
13
16
clientSecret : SLACK_CLIENT_SECRET ! ,
@@ -24,6 +27,9 @@ export const getSlackInstallUrl = ({
24
27
} : { integrationId : string ; organizationId : string ; projectId : string } ) => {
25
28
26
29
const slackInstaller = createSlackInstaller ( ) ;
30
+ if ( ! slackInstaller ) {
31
+ return null ;
32
+ }
27
33
return slackInstaller . generateInstallUrl ( {
28
34
scopes : [
29
35
'incoming-webhook' ,
You can’t perform that action at this time.
0 commit comments