Skip to content

Promote staging to master: seed content refresh + README fix - #49

Merged
YonatanHen merged 6 commits into
masterfrom
staging
Jul 30, 2026
Merged

Promote staging to master: seed content refresh + README fix#49
YonatanHen merged 6 commits into
masterfrom
staging

Conversation

@YonatanHen

Copy link
Copy Markdown
Owner

Small follow-up to the P1-P6 promotion (PR #11) — two commits landed on staging since:

Nothing else has changed since the last promotion.

YonatanHen and others added 5 commits July 30, 2026 19:38
Replace demo seed posts with general-interest content
…fallback

Google sign-in was rejecting every attempt in production with
redirect_uri_mismatch. The server was sending Google a callback of
http://localhost:5173/api/v1/auth/google/callback instead of the real
onrender.com URL.

Root cause: registerOAuthStrategies was built from
`process.env.PUBLIC_ORIGIN ?? 'http://localhost:5173'` directly in
routes/v1/auth.ts, bypassing the RENDER_EXTERNAL_URL fallback entirely —
that logic only lived inside env.ts's resolveFileBackedSecrets(), which
auth.ts never called. With PUBLIC_ORIGIN correctly left unset on Render
(per its own sync: false / "only needed for a custom domain" contract),
the raw process.env read was undefined and fell straight to the
hardcoded default.

Extracted resolvePublicOrigin() as a standalone function in env.ts,
independent of the full EnvSchema, and call it from auth.ts. It has to be
standalone rather than routed through loadEnv(): the full schema also
requires MONGODB_URI/SESSION_SECRET, which the test harness never
populates in process.env directly (those are passed to buildTestApp as
explicit options), so calling loadEnv() at OAuth-route time broke five
existing tests that don't need any of that to check a provider flag.

New regression test builds the actual test app with GOOGLE_CLIENT_ID set,
PUBLIC_ORIGIN unset, and RENDER_EXTERNAL_URL set to a fake onrender.com
URL, then asserts the real redirect_uri query param on the Google
redirect resolves to that URL, not localhost — reproducing the exact
failure from production. Lives in its own file: configuredProviders()
caches its result in a module-level singleton on first call, and
oauth.test.ts's own tests are already the first callers in that module
instance with no credentials configured.
fix(auth): route OAuth callback URLs through the RENDER_EXTERNAL_URL fallback

@YonatanHen YonatanHen left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@YonatanHen YonatanHen self-assigned this Jul 30, 2026
@YonatanHen
YonatanHen merged commit 2150e46 into master Jul 30, 2026
6 checks passed
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