slackapi / slackapi/deno-slack-runtime
[BUG] Locally running function keeps running after the function execution times out
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 18
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
Problem
If you have a top-level function running locally, and it takes longer than 15 seconds to run, it will be timed out by the Slack backend. However, when running locally, the function process would still be executing. This can lead to odd behaviours.
As soon as the 15 second local timeout is hit, the Slack CLI process / activity logs will output:
2024-06-03 10:07:47 [info] [Fn05HKNRE370] (Trace=Tr0767DPGA69) Function 'Approval' (app function) started
2024-06-03 10:08:03 [error] [Fn05HKNRE370] (Trace=Tr0767DPGA69) Function 'Approval' (app function) failed
event_dispatch_failed
2024-06-03 10:08:03 [error] [Wf05HURTRXTN] (Trace=Tr0767DPGA69) Workflow step 'Approval' failed
2024-06-03 10:08:03 [error] [Wf05HURTRXTN] (Trace=Tr0767DPGA69) Workflow 'Approval Workflow' failed
Function failed to execute
2024-06-03 10:08:03 [error] [Fn05HPEXTU5B] (Trace=Tr0767DPGA69) Function 'Approval Workflow' (workflow function) failed
Function failed to execute
At this point, however, the locally-running function is still executing. The SDK should, instead, kill the function. Otherwise, if the function continues to execute after this point and e.g. tries to return an error or complete the function, you will likely see the following in the CLI output:
functions.completeError response payload: { ok: false, error: "token_revoked" }
💌 We would love to know how things are going
Survey your development experience with slak feedback --name platform-improvements
The CLI process will also hang at this point, forcing the dev to Ctrl+C to kill it. This is likely a CLI bug (you can see the feedback prompt at the end, but the process itself has not completed).
Additionally: the deployed function behaviour / logging / experience will log out the following right after the deployed function times out:
error: function execution exceeded 60.0s timeout
Desired Fixes
- It would be good to provide a similar "function executed exceeded X timeout" error message in the local-run experience.
- It would be good if we could kill the function after this timeout, then we could eliminate the class of bugs regarding using a revoked token and possibly short circuit the CLI hung process as well.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the local SDK handles the 15-second timeout and how the CLI manages the function process afterward. Compare that path with the deployed timeout behavior described in the issue. Done means the local run reports a timeout, stops the function, and does not hang or attempt to use a revoked token.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- deno, typescript
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100