From 29bcbc623c29faff271c100b35c16c5680eddc49 Mon Sep 17 00:00:00 2001 From: Stephan Cilliers <5469870+stephancill@users.noreply.github.com> Date: Tue, 26 Mar 2024 21:22:24 +0200 Subject: [PATCH] fix(nextjs): prioritize APP_URL over VERCEL_URL --- .changeset/new-moose-talk.md | 5 +++++ packages/frames.js/src/next/getCurrentUrl.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/new-moose-talk.md diff --git a/.changeset/new-moose-talk.md b/.changeset/new-moose-talk.md new file mode 100644 index 000000000..c90a06f49 --- /dev/null +++ b/.changeset/new-moose-talk.md @@ -0,0 +1,5 @@ +--- +"frames.js": patch +--- + +fix(nextjs): prioritize APP_URL over VERCEL_URL diff --git a/packages/frames.js/src/next/getCurrentUrl.ts b/packages/frames.js/src/next/getCurrentUrl.ts index e979da50e..fcf35c982 100644 --- a/packages/frames.js/src/next/getCurrentUrl.ts +++ b/packages/frames.js/src/next/getCurrentUrl.ts @@ -6,7 +6,7 @@ export function getCurrentUrl( req: Request | NextRequest | NextApiRequest | IncomingMessage ): URL | undefined { const scheme = process.env.NODE_ENV === "production" ? "https://" : "http://"; - const appUrl = process.env.VERCEL_URL || process.env.APP_URL; + const appUrl = process.env.APP_URL || process.env.VERCEL_URL; const host: string | undefined = (req.headers as any)?.host; const pathname = req.url?.startsWith("/")