Skip to content

Commit d52a174

Browse files
committed
fix(slack): align setup checks with runtime
1 parent 9b6904c commit d52a174

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

apps/docs/content/docs/platform/self-hosting/integrations-oauth.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Webhook triggers receive callbacks from the provider and must be able to verify
196196
| `SLACK_SIGNING_SECRET` | Verifying Slack event and slash-command signatures |
197197
| `SLACK_EXTENDED_SCOPES` / `NEXT_PUBLIC_SLACK_EXTENDED_SCOPES` | Enabling the native Sim-app trigger and its broader Slack scope set; set both to the same value |
198198

199-
When enabling the native Sim Slack trigger, configure all three variables together. Slack OAuth actions can use `SLACK_CLIENT_ID` and `SLACK_CLIENT_SECRET` without enabling the native trigger or supplying a signing secret.
199+
When enabling the native Sim Slack trigger, configure all three variables together. Enable the extended-scope flags only after Slack approves the app for `assistant:write`, `app_mentions:read`, and `im:history`; otherwise Slack rejects OAuth authorization. Slack OAuth actions can use `SLACK_CLIENT_ID` and `SLACK_CLIENT_SECRET` without enabling the native trigger or supplying a signing secret.
200200

201201
Your deployment must also be reachable from the provider's servers for webhook triggers to fire — a Sim instance on a private network can use polling triggers but not webhook triggers. Polling triggers additionally require the scheduler; see [Background Jobs](/platform/self-hosting/background-jobs).
202202

packages/sim-setup/src/checks.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,25 @@ describe('setup coherence checks', () => {
4646
})
4747
})
4848

49+
it('treats a whitespace-only Slack signing secret as missing', async () => {
50+
const findings = await runChecks(
51+
rootContext({
52+
SLACK_EXTENDED_SCOPES: 'true',
53+
NEXT_PUBLIC_SLACK_EXTENDED_SCOPES: 'true',
54+
SLACK_SIGNING_SECRET: ' ',
55+
}),
56+
['coherence']
57+
)
58+
59+
expect(findings).toContainEqual({
60+
group: 'coherence',
61+
status: 'fail',
62+
message:
63+
'SLACK_EXTENDED_SCOPES is on but SLACK_SIGNING_SECRET is not set — native Slack triggers will fail at runtime',
64+
fix: 'set SLACK_SIGNING_SECRET or remove SLACK_EXTENDED_SCOPES and NEXT_PUBLIC_SLACK_EXTENDED_SCOPES',
65+
})
66+
})
67+
4968
it('does not require a signing secret for outbound-only Slack OAuth', async () => {
5069
const findings = await runChecks(
5170
rootContext({

packages/sim-setup/src/checks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ function checkCoherence(ctx: CheckContext): Finding[] {
482482
]
483483
for (const rule of featureRules) {
484484
if (!isTruthy(sim.vars.get(rule.flag))) continue
485-
const missing = rule.needs.filter((key) => !sim.vars.get(key))
485+
const missing = rule.needs.filter((key) => !sim.vars.get(key)?.trim())
486486
if (missing.length > 0) {
487487
findings.push({
488488
group: 'coherence',

0 commit comments

Comments
 (0)