Having the VERCEL
env variable set breaks dev server (rewrites to HTTPS & trigger ERR_SSL_PROTOCOL_ERROR
)
#8385
Labels
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Reproduction URL
https://github.com/nextauthjs/next-auth-example
Describe the issue
→ Having the
VERCEL
env variable set to any value breaks the dev server.Specifically, it seems to:
NEXTAUTH_URL
entirely,next-auth
endpoints tohttps
, leading to ssl errors if you're not developing on a https dev server→ Problem : the Vercel dev CLI (⚠️
vercel env pull
) adds this variable automatically to your env file!See https://vercel.com/docs/cli/env
Specifically, in a development environment it adds:
Therefore, VERCEL="1" should probably not be used to determine if the build is running on Vercel or hosted on Vercel. I suppose VERCEL_ENV or VERCEL_URL could be used to ensure that instead.
ℹ️ Strangely enough the problem only started with
next@13.4.13-canary.0
How to reproduce
Set
VERCEL="1"
in.env.local
in anynext-auth
app.Try to trigger any call to the
/api/auth/...
endpoints.The call will fail if you're on a http dev server, and in any case
NEXTAUTH_URL
will be ignored.Expected behavior
VERCEL
should not be used alone to determine if the app is built / running on Vercel servers ; therefore the app should work in development even withVERCEL="1"
, because that's the default for the Vercel env CLI.In video
CleanShot.2023-08-22.at.11.07.44.mp4
Workaround
I currently workaround by overriding my dev scripts:
The text was updated successfully, but these errors were encountered: