Better Auth works on localhost but NOT production server #269

Closed
opened 2026-03-13 07:40:17 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @trunglehuynh on GitHub (Nov 24, 2024).

Describe the bug
I tested Better-Auth on local dev(http://localhost:3000/), it is working fine but the production version (host in vercel.com) does not work, all GET and POST https://<www.mydomain.com>/api/auth/get-session requests return 404.

To Reproduce
Steps to reproduce the behavior:
Request GET and POST https://<www.mydomain.com>/api/auth/get-session and get return 404

Expected behavior
Those requests should return 200 as localhost:3000

Screenshots
n/a
Desktop (please complete the following information):
Google Chrome

Tried:
-I tested the production database, and It is working fine.
-update provider client_id and client_secret.

Originally created by @trunglehuynh on GitHub (Nov 24, 2024). **Describe the bug** I tested Better-Auth on local dev(http://localhost:3000/), it is working fine but the production version (host in vercel.com) does not work, all GET and POST https://<www.mydomain.com>/api/auth/get-session requests return 404. **To Reproduce** Steps to reproduce the behavior: Request GET and POST https://<www.mydomain.com>/api/auth/get-session and get return 404 **Expected behavior** Those requests should return 200 as localhost:3000 **Screenshots** n/a **Desktop (please complete the following information):** Google Chrome Tried: -I tested the production database, and It is working fine. -update provider client_id and client_secret.
Author
Owner

@anatoliy-t7 commented on GitHub (Nov 25, 2024):

Did you solve it?

@anatoliy-t7 commented on GitHub (Nov 25, 2024): Did you solve it?
Author
Owner

@trunglehuynh commented on GitHub (Nov 25, 2024):

yes, it was an env mistake, I set URL=https://<mydomain.com>/ , but it should be URL=https://<mydomain.com> without slash

@trunglehuynh commented on GitHub (Nov 25, 2024): yes, it was an env mistake, I set **URL=https://<mydomain.com>/** , but it should be **URL=https://<mydomain.com>** without slash
Author
Owner

@anatoliy-t7 commented on GitHub (Nov 26, 2024):

Thank for reply, but it does not work for me :(

@anatoliy-t7 commented on GitHub (Nov 26, 2024): Thank for reply, but it does not work for me :(
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#269