Skip to content

fix(social): clear error page when an OAuth provider isn't configured - #17

Merged
ralyodio merged 1 commit into
masterfrom
fix/social-oauth-graceful-when-unconfigured
May 22, 2026
Merged

ralyodio merged 1 commit into
masterfrom
fix/social-oauth-graceful-when-unconfigured

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

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.

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>
@ralyodio
ralyodio merged commit 1e8cf9c into master May 22, 2026
@ralyodio
ralyodio deleted the fix/social-oauth-graceful-when-unconfigured branch May 22, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant