.env variables are being read in production, documentation says they are not
Describe the bug
The documentation states "[in adapter-node] In production, .env files are not automatically loaded.", but variables that start with VITE_, PUBLIC_ and SECRET_ are being loaded without dotenv.
The fix would be to update the documentation to avoid surprises.
note: I think this is the reason of why so many people struggle with the ORIGIN env var, this makes it hard to debug
Reproduction
(there most be a simpler but I don't know how to print all the variables)
-
Add
SECRET_API_KEYandBODY_SIZE_LIMIT=Infinityvariable in a.envresult:SECRET_API_KEYis available but I get hit withPayload Too Large -
Add
BODY_SIZE_LIMIT=Infinityin the CLI before the production build my production cmd:BODY_SIZE_LIMIT=Infinity pm2 start node --name="prod" -- ./build/index.jsresult: everything works
Logs
No response
System Info
System:
OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (1) x64 AMD EPYC 7543 32-Core Processor
Memory: 1.37 GB / 1.91 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 20.11.0 - /usr/local/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 10.2.4 - /usr/local/bin/npm
npmPackages:
@sveltejs/adapter-auto: ^3.1.1 => 3.1.1
@sveltejs/adapter-node: ^4.0.1 => 4.0.1
@sveltejs/kit: ^2.5.0 => 2.5.0
@sveltejs/vite-plugin-svelte: ^3.0.2 => 3.0.2
svelte: ^4.2.10 => 4.2.10
vite: ^5.1.1 => 5.1.1
Severity
annoyance
Additional Information
I volunteer to update the doc. If interested let me know.