-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic Public Environment Variables are undefined in +server.ts endpoints #5941
Comments
Braindumping my investigation so far: this is happening because In theory they should be resolved to the same place, and Vite should just re-use the existing module. For some reason (possibly a bug in Vite? not 100% sure) that's not happening. Due to a quirk in the module resolution algorithm, this doesn't happen inside the |
I don't quite understand this part. Are we importing the modules with two different URLs that should ideally be deduped to one single instance? I can't find how this is happening in the codebase, maybe I'm missing something. |
#5955 does not fix this issue on Windows. Here are my findings: next.405
next.408
next.418
next.427
|
Describe the bug
Hello, I want to start off by thanking everyone involved for their hard work and clever ideas that have brought Svelte and Sveltekit to the points that the projects are at now 🥰
I updated to the latest version of Sveltekit today, and after going through all the migrations and fixing everything, I have one remaining problem in my project, that dynamic public environment variables are not available in +server.ts endpoints.
I made a simple example repository showing the issue. After you install and build it, you can see that the public dynamic is rendered correctly when you navigate to /
If you navigate to /static, the endpoint will return a public and a private static environment variable and display 'working foo'.
If you navigate to /dynamic, the endpoint will return a public and private dynamic environment variable, and should display 'working bar'. However, the public dynamic variable is undefined, so it displays 'undefined bar'.
Reproduction
https://github.com/ssbm-oro/sveltekit-dynamic-public-bug
Logs
No response
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: