[Fix] Derive SLACK_AUTH_URI from ROOMOTE_APP_URL when unset - #95
Merged
Conversation
Contributor
|
No code issues found. See task Verified the fallback lives in |
Contributor
Author
|
@openmote should we do the same for SLACK_REDIRECT_URI? |
|
I saw the mention, but I could not process it right now because the GitHub follow-up context was incomplete. Please try again in a moment. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
SLACK_AUTH_URIis unset, the Slack account-linking onboarding DM silently fails. The env schema defaults it to an empty string, so the "Link accounts" button URL becomes?state=<token>— Slack rejects the entirechat.postMessagewithinvalid_blocks("invalid url"), and unlinked users who DM the bot get no response at all.This hit the roomote-nightly Railway deployment on 2026-07-10: none of the fleet deployments set
SLACK_AUTH_URI(the ops provision script only setsROOMOTE_APP_URL).Fix
When
SLACK_AUTH_URIis unset or empty, derive it fromROOMOTE_APP_URLas${ROOMOTE_APP_URL}/api/slack/auth— the route the web app already serves for completing the link (apps/web/src/app/api/slack/auth/route.ts). An explicitly setSLACK_AUTH_URIstill wins.The fallback lives in
buildRoomoteRuntimeEnv(packages/env) rather than at the button-building site, so every service that constructs env — includingrehydrateEnvand the web bootstrap — gets it, matching the existing derivation pattern forSLACK_API_TIMEOUT_MSandDOCKER_WORKER_IMAGE.Changes
packages/env/src/index.ts— deriveSLACK_AUTH_URIfromROOMOTE_APP_URLwhen unset/empty (trailing slashes trimmed)packages/env/src/__tests__/index.test.ts— tests for the fallback (unset, empty, trailing slash) and explicit-override precedenceapps/docs/environment-variables.mdx— document the defaultValidation
pnpm --filter @roomote/env exec vitest run src/__tests__/index.test.ts— 53 passedpnpm --filter @roomote/slack exec vitest run src/__tests__/block-kit.test.ts— 21 passedpnpm lintandpnpm check-types— clean across all workspacesNo fleet config change needed: deployments already set
ROOMOTE_APP_URL, so the next deploy with this commit fixes the silent DM failure.