Error Deploying to Vercel: Missing NEXT_APP_URL
IAmLuisJ opened this issue · 1 comments
I'm not sure if anyone else has run into this, but when I was trying to deploy to Vercel the build kept failing because it said I was missing NEXT_APP_URL, but the NextAuth.JS documentation says this variable isn't required when deploying to Vercel.
I double checked that "Automatically expose System Environment Variables" was turned on as well.
Error:
`
Build error occurred
--
21:42:36.838 | TypeError: ========================================
21:42:36.838 | 💨 Missing environment variables:
21:42:36.839 | NEXT_APP_URL: Missing value or empty string
21:42:36.839 | ========================================
21:42:36.840 | at d (/vercel/path0/node_modules/envsafe/dist/envsafe.cjs.production.min.js:1:3206)
21:42:36.840 | at exports.envsafe (/vercel/path0/node_modules/envsafe/dist/envsafe.cjs.production.min.js:1:4852)
21:42:36.840 | at Object.5395 (/vercel/path0/.next/server/pages/sign-in.js:81:37)
21:42:36.841 | at webpack_require (/vercel/path0/.next/server/webpack-runtime.js:25:42)
21:42:36.841 | at webpack_exec (/vercel/path0/.next/server/pages/sign-in.js:368:39)
21:42:36.843 | at /vercel/path0/.next/server/pages/sign-in.js:369:66
21:42:36.844 | at Function.webpack_require.X (/vercel/path0/.next/server/webpack-runtime.js:182:21)
21:42:36.844 | at /vercel/path0/.next/server/pages/sign-in.js:369:47
21:42:36.845 | at Object. (/vercel/path0/.next/server/pages/sign-in.js:372:3)
21:42:36.845 | at Module._compile (internal/modules/cjs/loader.js:1085:14) {
21:42:36.845 | type: 'TypeError'
21:42:36.846 | }
`
I was able to get it working by adding an environment variable for NEXT_APP_URL and a valid full URL.
From looking at the Vercel Documentation I wonder if this was changed to NEXT_PUBLIC_VERCEL_URL
If others are seeing this issue maybe something can be added to the readme like "When deploying to vercel you may have to set the NEXT_APP_URL which is validated as a URL so be sure to include the full URL. For example: https:///www.appName.vercel.app in your Environment Variables."
The NEXT_APP_URL
env variable is mostly used for the slack integration and not for Next-auth https://github.com/planetscale/beam/blob/main/lib/slack.ts#L23 , so I think it will be a good idea to make it optional if the slack integration is not enabled.