Skip to content

Commit 2a1be17

Browse files
committed
fix baseURL
1 parent b5801aa commit 2a1be17

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/auth-client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { createAuthClient } from 'better-auth/react';
2+
import { env } from './env.mjs';
23
export const authClient = createAuthClient({
34
/** The base URL of the server (optional if you're using the same domain) */
4-
baseURL: 'http://localhost:3000',
5+
baseURL: env.BETTER_AUTH_URL,
56
});

src/env.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const server = z.object({
1111
BETTER_AUTH_URL: z.preprocess(
1212
// This makes Vercel deployments not fail if you don't set BETTER_AUTH_URL
1313
// Since Better Auth automatically uses the VERCEL_URL if present.
14-
(str) => process.env.VERCEL_URL ?? str,
14+
(str) => `https://${process.env.VERCEL_URL}` ?? str,
1515
// VERCEL_URL doesn't include `https` so it cant be validated as a URL
1616
process.env.VERCEL ? z.string().min(1) : z.string().url(),
1717
),

0 commit comments

Comments
 (0)