issue with better auth base url configuration

i'm experiencing a problem with better-auth where the login function sends requests to localhost:3000 despite setting BETTER_AUTH_URL in the environment. according to the docs, the base url should be configured with BETTER_AUTH_URL, and there's no trailing slash. however, i'm still getting an error that the base url is invalid and the connection is refused. I'm using better auth with elysia and drizzle adapter, I deploy the app on sevalla if anyone is wondering. really appreciate if anyone can help me out with this because I tested and it work normally on my dev environment and even in my local container.
No description
No description
5 Replies
Sthap
SthapOP4d ago
here's the code of my auth and auth client
No description
No description
Sthap
SthapOP4d ago
update: I've changed baseURL in auth client to process.env.NEXT_PUBLIC_SITE_URL and now it send the request through with a proper url now but I got not found status from /auth/* instead I suspect it might be an error or I config something wrong in elysia backend
No description
Sthap
SthapOP4d ago
error from sevalla logs: [better-call]: Make sure the URL has the basePath (/https://seat-reseeee-ftkln.kinsta.app).
Sthap
SthapOP3d ago
here's my elysia auth setup
No description
Sthap
SthapOP3d ago
solved the issue by just set basePath to /api/auth
No description

Did you find this page helpful?