Skip to content

Commit d7393d8

Browse files
authored
fix(pro): downgrade @clerk/clerk-js to v5 to restore auto-mount UI (koala73#3232)
The actual root cause behind the "Clerk was not loaded with Ui components" sign-in failure on /pro is NOT the import path — it's that pro-test was on @clerk/clerk-js v6.4.0 while the main app (which works fine) is on v5.125.7. Clerk v6 fundamentally changed `clerk.load()`: the UI controller is no longer auto-mounted by default. Both `@clerk/clerk-js` (the default v6 entry) and `@clerk/clerk-js/no-rhc` (the bundled-UI variant) expect the caller to either: - load Clerk's UI bundle from CDN and pass `window.__internal_ClerkUICtor` to `clerk.load({ ui: { ClerkUI } })`, or - manually wire up `clerkUICtor`. That's why my earlier "switch to no-rhc" fix (PR koala73#3227 + koala73#3228) didn't actually unbreak production — both v6 variants throw the same assertion. The error stack on the deployed bundle confirmed it: `assertComponentsReady` from `clerk.no-rhc-UeQvd9Xf.js`. Fix: pin pro-test to `@clerk/clerk-js@^5.125.7` to match the main app's working version. v5 still auto-mounts UI on `clerk.load()` — no extra wiring needed. The plain `import { Clerk } from '@clerk/clerk-js'` pattern (which the main app uses verbatim and which pro-test had before koala73#3227) just works under v5. Verification of the rebuilt bundle (chunk: clerk-PNSFEZs8.js): - 3.05 MB (matches main app's clerk-DC7Q2aDh.js: 3.05 MB) - 44 occurrences of mountComponent (matches main: 44) - 3 occurrences of SignInComponent (matches main: 3) - 0 occurrences of "Clerk was not loaded with Ui" (the assertion error string is absent; UI is unconditionally mounted) Includes the rebuilt public/pro/ artifacts so this fix is actually deployed (PR koala73#3229's CI check will catch any future PR that touches pro-test/src without rebuilding).
1 parent 0a4eff0 commit d7393d8

9 files changed

Lines changed: 2480 additions & 2091 deletions

File tree

pro-test/package-lock.json

Lines changed: 1378 additions & 1816 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pro-test/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"lint": "tsc --noEmit"
1111
},
1212
"dependencies": {
13-
"@clerk/clerk-js": "^6.4.0",
13+
"@clerk/clerk-js": "^5.125.7",
1414
"@sentry/react": "^10.47.0",
1515
"@tailwindcss/vite": "^4.1.14",
1616
"@vitejs/plugin-react": "^5.0.4",

pro-test/src/services/checkout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function ensureClerk(): Promise<InstanceType<typeof Clerk>> {
3232
}
3333

3434
async function _loadClerk(): Promise<InstanceType<typeof Clerk>> {
35-
const { Clerk: C } = await import('@clerk/clerk-js/no-rhc');
35+
const { Clerk: C } = await import('@clerk/clerk-js');
3636
const key = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY;
3737
if (!key) throw new Error('VITE_CLERK_PUBLISHABLE_KEY not set');
3838
const instance = new C(key);

public/pro/assets/clerk-PNSFEZs8.js

Lines changed: 849 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/pro/assets/clerk.no-rhc-UeQvd9Xf.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

public/pro/assets/index-CFLOgmG-.js

Lines changed: 0 additions & 248 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/pro/assets/index-zHF6-nOX.js

Lines changed: 248 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/pro/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@
144144
}
145145
</script>
146146
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit" async defer></script>
147-
<script type="module" crossorigin src="/pro/assets/index-CFLOgmG-.js"></script>
148-
<link rel="stylesheet" crossorigin href="/pro/assets/index-DKmiaSn4.css">
147+
<script type="module" crossorigin src="/pro/assets/index-zHF6-nOX.js"></script>
148+
<link rel="stylesheet" crossorigin href="/pro/assets/index-InU6PrNf.css">
149149
</head>
150150
<body>
151151
<div id="root">

0 commit comments

Comments
 (0)