Problem with building @convex-dev/auth@0.0.50 in deployment
I have used the react import and it worked perfectly in development but not in production with nextjs.
I updated the package and imported the
ConvexAuthNextjsProvider
and was hit with this error, any idea how I can resolve it?23 Replies
did you ever figure this out
Not yet!
its a sad world
š„²
Wow, hehe, you're very smart person. :Pepe_5:
Since this is a Next.js project can you try using the
ConvexAuthNextjsClientProvider
instead of ConvexAuthProvider
?
The one you're using doesn't work in server, the value of the context will be undefined. Another solution would be to ensure the Provider is run on the client by adding "use client" to the file where you define the component that renders this provider.I may not have made it clear, I apologise:
this is my code after the upgrade:
in which I'm facing the issue,
also, I couldn't find
ConvexAuthNextjsClientProvider
declaration, can you lead me to it please?
Update: THE PROBLEM IS I FORGOT TO ADD JWKS TO MY ENVIROMENT VARIABLESI went with what Michel did here and revised the docs to see what I'm missing, and yep, its the jwks!!!
https://github.com/get-convex/convex-auth/tree/main/test-nextjs
GitHub
convex-auth/test-nextjs at main Ā· get-convex/convex-auth
Library for built-in auth. Contribute to get-convex/convex-auth development by creating an account on GitHub.
2 hours of mess around and find out
ššš
glad to hear it's working now!
Almost
Some other issues are caused and I'm trying to figure that out soon (like the userId is null even though it's within the client context)
I have some issues like that too
I gave up
š
I can't give up
Potentially cause I'll face this issue in the future
Never back down never what?
@v can you file a separate thread?
@Sara if you don't need server-side-authentication you can keep using the /react provider, it's a simpler setup. Otherwise you need to follow all the App Router with SSA setup steps.
Lmk if anything isn't working.
so, so far I switched back to client context
and I don't need server-side-authentication, but would be great to have it
and I would love it if you could provide another example with the
/src
directory, since its not working the exact same way as when its /app
Why are you using /src with App Router btw?
its actually wasn't even for my projects i was helping someone
its a personal preference
Since every other framework I use sets a
/src
directory and it has become more convenient and organisedAnd what issues are you running into when using the /src directory and Convex Auth? I'd imagine it works identically except you need to put all files in src/, so middleware goes to src/, components to src/app/, convex files stay in convex/
alright that's fair, you'd be correct, the user is being viewed when you pull middleware, and app and components into
/src
I tried that with your https://github.com/get-convex/convex-auth/tree/main/test-nextjs
GitHub
convex-auth/test-nextjs at main Ā· get-convex/convex-auth
Library for built-in auth. Contribute to get-convex/convex-auth development by creating an account on GitHub.
so the issue I'm having is with my personal project, will try to figure that out later
thank you @Michal Srb