Skip to content

Commit

Permalink
[Bug] Fix chained function actions (#2200)
Browse files Browse the repository at this point in the history
  • Loading branch information
misscoded authored Aug 14, 2024
1 parent b10bbb0 commit 23ef516
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,7 @@ export default class App<AppCustomContext extends StringIndexed = StringIndexed>
if (functionInputs) { context.functionInputs = functionInputs; }
}

// Attach and make available the JIT/function-related token on context
if (this.attachFunctionToken) {
if (functionBotAccessToken) { context.functionBotAccessToken = functionBotAccessToken; }
}
Expand Down Expand Up @@ -1091,7 +1092,11 @@ export default class App<AppCustomContext extends StringIndexed = StringIndexed>

// Get the client arg
let { client } = this;
const token = selectToken(context);

// If functionBotAccessToken exists on context, the incoming event is function-related *and* the
// user has `attachFunctionToken` enabled. In that case, subsequent calls with the client should
// use the function-related/JIT token in lieu of the botToken or userToken.
const token = context.functionBotAccessToken ? context.functionBotAccessToken : selectToken(context);

// Add complete() and fail() utilities for function-related interactivity
if (type === IncomingEventType.Action && context.functionExecutionId !== undefined) {
Expand Down

0 comments on commit 23ef516

Please sign in to comment.