vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.7k stars 26.84k forks source link

vercel deploy --prebuilt causes system environment variables to disappear #54146

Open Justinfan827 opened 1 year ago

Justinfan827 commented 1 year ago

Verify canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000
    Binaries:
      Node: 20.4.0
      npm: 9.7.2
      Yarn: 1.22.19
      pnpm: 8.6.0
    Relevant Packages:
      next: 13.4.17-canary.0
      eslint-config-next: 13.4.16
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.6
    Next.js Config:
      output: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

https://github.com/Justinfan827/testing-vercel-cli

To Reproduce

compare the deployed site when running:

vercel build
vercel deploy --prebuilt

vs

vercel deploy

Describe the Bug

When running vercel deploy, the environment variable NEXT_PUBLIC_VERCEL_URL is populated correctly. However, when running vercel build and vercel deploy --prebuilt, this env var disappears.

Screenshot 2023-08-16 at 3 09 51 PM Screenshot 2023-08-16 at 3 12 28 PM

Expected Behavior

NEXT_PUBLIC_VERCEL_URL should always get populated even if running vercel build and vercel deploy --prebuilt

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Vercel

rychlis commented 2 months ago

I've also encountered this issue. I can see VERCEL_URL does work, but NEXT_PUBLIC_VERCEL_URL is not available in deployments created with vercel deploy --prebuilt