From 23ef516e96ec32fbb85c904e8001e34a5b8ab6ad Mon Sep 17 00:00:00 2001 From: Alissa Renz Date: Wed, 14 Aug 2024 12:02:02 +0000 Subject: [PATCH] [Bug] Fix chained function actions (#2200) --- src/App.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/App.ts b/src/App.ts index ac4cbefd7..184063f81 100644 --- a/src/App.ts +++ b/src/App.ts @@ -976,6 +976,7 @@ export default class App if (functionInputs) { context.functionInputs = functionInputs; } } + // Attach and make available the JIT/function-related token on context if (this.attachFunctionToken) { if (functionBotAccessToken) { context.functionBotAccessToken = functionBotAccessToken; } } @@ -1091,7 +1092,11 @@ export default class App // 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) {