fix(social): clear error page when an OAuth provider isn't configured - #17
Merged
Merged
Conversation
User report: /api/sp/oauth/threads/start returns a generic 500. Root cause: META_APP_ID / META_APP_SECRET (and every other social provider's credentials) are not set on Railway, so the platform module throws "META_APP_ID not configured" deep in the call stack. Hardened each /start handler. New helper lib/sp/require-env.ts maps platform name → required env keys. Every start route calls requirePlatformEnv(platform) first; if any key is missing it returns a 503 with a human-readable HTML page that tells the user the integration isn't set up and lists the missing env vars for an admin to copy into Railway. Updated routes: - /api/sp/oauth/threads/start (META_APP_ID, META_APP_SECRET) - /api/sp/oauth/facebook/start (META_APP_ID, META_APP_SECRET) - /api/sp/oauth/linkedin/start (LINKEDIN_CLIENT_ID, LINKEDIN_CLIENT_SECRET) - /api/sp/oauth/x/start (X_CLIENT_ID, X_CLIENT_SECRET) - /api/sp/oauth/reddit/start (REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET) Mastodon /start is per-instance OAuth (no env-level credentials) so it's untouched. Code-only fix — actually making the integrations WORK still needs the admin to register the OAuth apps on each platform and set the credentials on Railway. The error page now tells them exactly which keys are missing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Replaces the 500 thrown deep in platform code with a 503 + readable HTML page that lists exactly which env vars are missing. Doesn't make the integrations work — admin still has to register the OAuth apps on each platform and set the credentials on Railway — but failure mode is now clear instead of cryptic.