-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
The docs for $env/dynamic/public state:
This module provides access to runtime environment variables, as defined by the platform you're running on.
For pre-rendered pages though, this is incorrect and misleading. They actually behave more like $env/static/public with values coming from build-time .env files used. Not only does this risk exposing information that wasn't intended to be exposed but the behavior of the app becomes indeterminate because the values used in the app depend on the order of page navigation.
As an example, I'm using $env/dynamic/public to read Firebase config from runtime environment values set in Google Cloud Run. Every so often Firebase auth on the client would fail, but a page refresh would always fix it. It depended on which page was initially viewed and exposed development-use configuration that was not intended to be exposed.
Reproduction
See https://github.com/CaptainCodeman/svelte-kit-10008
Logs
No response
System Info
System:
OS: macOS 13.3.1
CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
Memory: 36.28 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.10.0 - ~/Library/pnpm/node
npm: 8.19.2 - ~/Library/pnpm/npm
Browsers:
Brave Browser: 106.1.44.112
Chrome: 113.0.5672.126
Chrome Canary: 115.0.5786.0
Firefox: 111.0.1
Safari: 16.4
Safari Technology Preview: 16.4
npmPackages:
@sveltejs/adapter-node: ^1.2.4 => 1.2.4
@sveltejs/kit: ^1.18.0 => 1.18.0
svelte: ^3.59.1 => 3.59.1
vite: ^4.3.8 => 4.3.8Severity
annoyance (had to disable pre-rendered pages for correct functionality)
Additional Information
Maybe related to #8946