feat: self-hosted socket mode entrypoint for Deno workflow apps#85
feat: self-hosted socket mode entrypoint for Deno workflow apps#85
Conversation
0112e9e to
b5030bb
Compare
| "--config=deno.jsonc", | ||
| "--allow-read", | ||
| "--allow-env", | ||
| "--allow-sys=osRelease", |
There was a problem hiding this comment.
I don't know why CLI-managed socket mode does not already require this permission to be set :not-sure:
The 'self hosted' script executes functions the same way as the 'local run' script; we run local-run-function.ts as a subprocess, which dispatches function execution to run-function.ts, which should ultimately call functions.completeSuccess or functions.completeFailure using BaseSlackAPIClient. As per Cursor: BaseSlackAPIClient uses Node’s os.release(), which in Deno is implemented with Deno.osRelease() and requires --allow-sys=osRelease
The local run start hook does run it with that permission, but the flags for the parent process don't get passed into the subprocess :confused_math_lady:
deno run -q --config=deno.jsonc --allow-read --allow-net --allow-run --allow-env --allow-sys=osRelease https://deno.land/x/deno_slack_runtime@1.1.3/local-run.ts
| const client = new SocketModeClient({ | ||
| appToken, | ||
| logLevel, | ||
| logger, |
There was a problem hiding this comment.
The local run script uses the 'hook CLI protocol' for logging, but since it's not applicable here we just use the Logger that the socket mode client accepts
b5030bb to
3b63327
Compare
Summary
This PR adds an entrypoint for running Deno apps via an SDK-managed socket connection
Testing
Running an app via the CLI:
slack-public create --template https://github.com/slack-samples/deno-starter-template).slack/hooks.jsonfile with the following:lack runas we do for CLI-managed local appsRunning the app without the CLI:
export SLACK_APP_TOKEN=...and optionally,export SLACK_BOT_TOKEN=...,export SLACK_API_URL=https://dev.slack.com/api) and run the Deno command directly;deno run -q --config=deno.jsonc --allow-read --allow-net --allow-env --allow-run --allow-sys file:///Users/evegeris//dev/deno-slack-runtime/src/self-hosted-socket-mode.tsRequirements