Skip to content

Commit 8ac3a9c

Browse files
committed
chore: use process.env.VERCEL to detect Vercel
1 parent 7195b8e commit 8ac3a9c

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/jwt/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export async function getToken<R extends boolean = false>(
7171
const {
7272
req,
7373
secureCookie = process.env.NEXTAUTH_URL?.startsWith("https://") ??
74-
!!process.env.VERCEL_URL,
74+
!!process.env.VERCEL,
7575
cookieName = secureCookie
7676
? "__Secure-next-auth.session-token"
7777
: "next-auth.session-token",

src/lib/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export type NextAuthAction =
5050
export interface InternalOptions<T extends ProviderType = any> {
5151
providers: InternalProvider[]
5252
/**
53-
* Parsed from `NEXTAUTH_URL` or `VERCEL_URL`.
53+
* Parsed from `NEXTAUTH_URL` or `x-forwarded-host` on Vercel.
5454
* @default "http://localhost:3000/api/auth"
5555
*/
5656
url: InternalUrl

src/next/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function setCookie(res, cookie: Cookie) {
1717
/** Extract the host from the environment */
1818
export function detectHost(forwardedHost: any) {
1919
// If we detect a Vercel environment, we can trust the host
20-
if (process.env.VERCEL === "1") return forwardedHost
20+
if (process.env.VERCEL) return forwardedHost
2121
// If `NEXTAUTH_URL` is `undefined` we fall back to "http://localhost:3000"
2222
return process.env.NEXTAUTH_URL
2323
}

0 commit comments

Comments
 (0)