Skip to content

Fix missing Clerk auth UI on sign-in and sign-up#77

Merged
DevCalebR merged 1 commit into
mainfrom
fix/clerk-auth-ui-csp
May 25, 2026
Merged

Fix missing Clerk auth UI on sign-in and sign-up#77
DevCalebR merged 1 commit into
mainfrom
fix/clerk-auth-ui-csp

Conversation

@DevCalebR

Copy link
Copy Markdown
Owner

Root cause:
This issue was primarily CSP, not Clerk path routing. The live production SignUp page loaded Clerk from the custom Frontend API origin https://clerk.callbackcloser.com, but our production CSP only allowed https://.clerk.com and https://.clerk.accounts.dev. The browser blocked clerk.browser.js, so the page shell rendered but the right-side Clerk SignUp/SignIn UI stayed blank.

Secondary path/routing hardening:
The auth pages were also passing env-normalized Clerk URLs into the widget path props. That was not the production blank-state root cause, but the page now uses stable base paths (/sign-up and /sign-in) for Clerk routing and strips query params from env-derived auth URLs to avoid future path mismatches.

What changed:

  • decode the Clerk Frontend API origin from NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and include it in production CSP
  • add the Clerk-required CSP allowances for the custom Frontend API origin, img.clerk.com, worker-src, and challenges.cloudflare.com
  • keep stable Clerk widget paths by using /sign-up and /sign-in directly in the SignUp and SignIn components
  • normalize env auth URLs to base paths only in lib/clerk-config.ts
  • if Clerk env is invalid, let /sign-in and /sign-up render a clear auth-unavailable state instead of a blank right column

Validation:

  • npm run typecheck
  • npm run lint
  • npm test
  • npm run build

Manual incognito QA results:

Notes:

  • Because the production Clerk key is domain-locked, full widget rendering can only be finally confirmed on callbackcloser.com or a properly configured preview domain after deploy. The local production-mode run confirms the CSP block itself is resolved.

@vercel

vercel Bot commented May 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
callbackcloser Ready Ready Preview, Comment May 25, 2026 11:09pm

Request Review

@DevCalebR DevCalebR merged commit f17afad into main May 25, 2026
3 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