[codex] fix oauth callback host and harden sql migration replay#15
Merged
Conversation
✅ Deploy Preview for tradiaai ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Summary
This PR fixes production Google OAuth callback host resolution and hardens SQL migration replay so remote Supabase execution can be re-run safely using CLI credentials from
.env.local.It also carries the phase-3 market bias slice that was implemented in the same working stream (API, service, types, migration, and dashboard integration).
User-impacting fix: Google OAuth callback host
Users were still being redirected through
http://localhost:3000/api/auth/callback/googleduring "Continue with Google" in environments where stale/malformed host env values leaked into runtime behavior.Root cause
authOptionshandled malformed URL strings, but did not force request-derived host resolution at the API route boundary.Fix
app/api/auth/[...nextauth]/route.tsto derive and setNEXTAUTH_URLper request fromx-forwarded-host/hostand protocol headers.https://tradiaai.appwhenever request host is missing or localhost-like.src/lib/authOptions.ts.This ensures callback URLs are generated from the actual deployed host in production, not localhost.
SQL replay hardening and Supabase push work
The user requested pushing all SQL with
SUPABASE_ACCESS_TOKEN+SUPABASE_DB_PASSWORDfrom.env.local.What was done
Representative files hardened
database/migrations/002_create_user_feedback_table.sqldatabase/migrations/003_fix_column_names.sqldatabase/migrations/004_enable_rls.sqldatabase/migrations/005_fix_foreign_key.sqldatabase/migrations/006_fix_rls.sqldatabase/migrations/007_complete_setup.sqldatabase/migrations/008_final_rls_fix.sqldatabase/migrations/2025-01-15_add_lemonsqueezy_support.sqldatabase/migrations/2026-04-09_add_pre_trade_brief_review_fields.sqldatabase/migrations/create_trading_accounts.sqldatabase/migrations/create_user_profiles.sqldatabase/migrations/enhance_trading_accounts.sqldatabase/migrations/seed_sample_analytics.sqlmigrations/002_remove_mt5_integration.sqlmigrations/006_add_mt5_tables.sqlPhase-3 market bias implementation included
database/migrations/2026-04-18_create_market_bias_reports.sqlapp/api/market-bias/route.tssrc/lib/forex/marketBiasService.tssrc/types/marketBias.tsapp/dashboard/pre-trade-brief/page.tsxapp/api/pre-trade-brief/route.tsValidation
npm run type-checkpasses..env.localcredentials.Notes
This PR intentionally keeps all fixes in one branch because the user requested the OAuth fix first, then phase continuation, plus SQL push hardening in the same workflow.