Better Auth with Convex working in dev but broken in prod
I am trying to get authentication to work with my convex + better auth set up. I've got the following envs in my dev and production deployments in Convex:
. In development, everything works fine however in production I am unable to login or sign up. I am able to create an account but in production it gives me this error:
My
getCurrentUser method looks like this:
I would really appreciate some help here I've been trying for hours to resolve this and find out what is causing this because in production it is just not working. It's deployed on vercel11 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
This a brand new repo you working on?
Yeah
Are you able to share link or send code? need to see full picture as it will be much easier for me to help.
Yeah let me DM you the repo
ty
@aith i’m almost 100% sure you are just missing the correct env variable with the production url somewhere. either you have a cors issue with the cross domain plugin, or google auth isn’t being given the correct url in the google cloud console settings. lmk
All the envs were set up (and I'm only using email password no Oauth). The problem is somehow with the middleware. In production the redirect doesn't work and I haven't been able to figure out why yet
are you on next?
Yes
that’s always the other problem lol
so hard to troubleshoot
most of the time the only difference in prod is the env variables or the url somehow