Upon deploying my NextJS application to Vercel, I get the following error log in preview/production:
TypeError: Invalid URL
at new n (.next/server/chunks/9030.js:1:36758)
at V (.next/server/chunks/6191.js:64:246284)
at 36335 (.next/server/chunks/6191.js:64:246459)
at t (.next/server/webpack-runtime.js:1:143)
at 35168 (.next/server/chunks/9030.js:1:26444)
at t (.next/server/webpack-runtime.js:1:143)
at 81327 (.next/server/chunks/9030.js:1:44499)
at Object.t [as require] (.next/server/webpack-runtime.js:1:143) {
code: 'ERR_INVALID_URL',
input: 'httpeace-lar73vvf5-pcnlabs.vercel.app',
digest: '3781670148'
}
In my codebase, I make no explicit reference to VERCEL_URL, nor do I use “new URL” without adding “https://”. I suspect it might have something to do with NextAuth, but can’t confirm. I have tried setting the AUTH_URL env, and removing it, but in both cases the error happens. I have " Automatically expose System Environment Variables" on.
What could possibly be happening?