Latest version of Clerk creating issues with convex clerk provider

.../node_modules/convex/dist/esm/react-clerk/ConvexProviderWithClerk.js:2 @astria/next:dev: import { useAuth } from "@clerk/clerk-react"; @astria/next:dev: ^^^^^^^ @astria/next:dev: SyntaxError: Named export 'useAuth' not found. The requested module '@clerk/clerk-react' is a CommonJS module, which may not support all module.exports as named exports. I'm running into the following error after updating clerk. I can downgrade in the meantime but wanted to see if there's a potential solution here.
7 Replies
ballingt
ballingt2y ago
Thanks for the heads up, I'll check this out. @Chad Maycumber I can't repro this with a simple setup, could I get some more info? - what version of Clerk works for you, what version doesn't? - what's @astria? - what bundler or dev server are you using? - do you see this issue when you do a build too and run too, or only in dev mode? also feel free to share the repo with thomasballinger on GitHub or send a zipfile of the code to tom@convex.dev
ballingt
ballingt2y ago
I'm guessing the upgrade crosses this boundary https://github.com/clerkinc/javascript/blob/main/packages/react/CHANGELOG.md#4190, sounds like an ESM/CJS thing
GitHub
javascript/packages/react/CHANGELOG.md at main · clerkinc/javascript
Official Javascript repository for Clerk authentication - javascript/packages/react/CHANGELOG.md at main · clerkinc/javascript
Chad Maycumber
Chad MaycumberOP2y ago
Hey @astria is a yarn workspace. I’ll try to get some more system details for you Yeah that’s correct I added a yarn resolution to clerk 4.18.0 bc anything above it didn’t work
ballingt
ballingt2y ago
I opened https://discord.com/channels/856971667393609759/1121919141180350555/1121919141180350555 to ask the Clerk team about this, other folks are reporting similar SyntaxError: Named export 'useAuth' not found. issues there but I don't see something tying them together yet.
Chad Maycumber
Chad MaycumberOP2y ago
Awesome thanks. I’ll keep in eye out in the clerk community then as well
ballingt
ballingt2y ago
If you get the chance I'd love to know how you're bundling this so I can make a repro, Clerk said they couldn't help much without one. Guessing it's something like "project uses ESM (type: "module" in package.json), Convex is loaded via ESM, but then Clerk is loaded CJS.
Chad Maycumber
Chad MaycumberOP2y ago
I'll see if I can look into some of this today

Did you find this page helpful?