Convex + better auth 400 code with no errors
Hey, I was just trying to setup better auth with convex, but for some reason I always get a weird 400 error with "Invalid body parameters" for the
/api/auth/sign-in/social
route. No matter what provider I use, it's always the same.
All my .env variables are there and working14 Replies
How are you calling the endpoint?
await authClient.signIn.social({ provider: "discord" });
Sorry for the ping, but should I try anything else? Still haven't been able to figure out what's wrong. I am happy to provide my code and logs if needed
can you show me your auth config?
The
Invalid body parameters
doesn't make sense since you provided the right values, so I suspect it might be caused by the Convex integration's implementationSure, my auth config looks like this: `
No runtime errors on the NextJS side except for the 400 route log as well
Nothing in Convex logs too
Can you show me the network panel in dev tools of this?
Of it erroring



I just copied their NextJS handler code and added some logging to see where the error occurs, I guess it's on their side then?

Then again, it might not be. In the convex api route, the better-auth.handler() is actually what returns the Invalid parameters body

Oh, yeah that would explain it. Otherwise your code looks fine to me.
I recommend opening an issue on their github
https://github.com/get-convex/better-auth
GitHub
GitHub - get-convex/better-auth: Convex + Better Auth 🔥
Convex + Better Auth 🔥. Contribute to get-convex/better-auth development by creating an account on GitHub.
I have created an issue but will leave this open for now if that is fine with you
yeah no worries
Fixed it! Followed an old thread on the convex discord that had the exact same problem on here. It was a node 20.09 issue. Upgrading to 24 fixed it. Really weird issue not gonna lie. I would have never found that solution without that thread, i'm one lucky mf
But now I'm getting this without any application errors 😐 Probably a simple fix (let's hope)
