Changing a NEXT_PUBLIC_ value and restarting the server left this browser display at its build-time value. A dynamically rendered Server Component, however, read the server-only value supplied at startup.
With process.env , the time at which a value is determined matters. One Next.js 16.3.4 build was started under two different environments.
Give build and startup different values
Every value is a synthetic string that is safe to display:
Phase ARTICLE_SERVER_LABEL NEXT_PUBLIC_ARTICLE_LABEL
Build server-build-A public-build-A
Startup B server-runtime-B public-runtime-B
Startup C server-runtime-C public-runtime-C
B was stopped before starting C, with no rebuild between them. Their BUILD_ID values matched. This is not a test of .env precedence; values were passed explicitly to the processes.
The environment-variable documentation describes inlining directly referenced public values during the build and freezing them afterward.…