-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
getSession didn't get called in production. development and preview runs ok. #5323
Comments
FWIW, I added a getSession to the demo app with the node adapter and it's running fine in all modes. Please provide a proper minimal reproduction for the issue in the form of a public git repo. |
Updated reproduction in first post. https://github.com/taganchua/TestApp Login button is in first page. And the cookie is UserID: undefined After click login, UserID would be "TesterName". Development works fine. Preview cannot work. I put console.log() in getSession(). It didn't get called in my side. Before login After login Preview |
i had the same issue, and it turned out that |
this line is the reason why getSession() is not called in production, since this flag is setting the whole page (and its children) to be precompiled (in production) and thus accessing this route will only return a static html page to the client disregarding the hooks logic |
Forgot to remove that in this TestApp project. But my old project has set prerender = false already. I'll double check. |
Weird, my old project now ok. It couldn't work yesterday and I didn't even change any code in my old project today. Thanks anyway! |
Describe the bug
Before I update npms,
my project is old and use Sveltekit v1.0.0-next.326. vite 2.9.8.
svelte.config.js
hooks.ts
It runs fine in all enivornments.
Some npm modules are outdated and after I updated some npm modules (Sveltekit v1.0.0-next.357. vite 2.9.13), development and preview run OK. But production cannot work. getSession didn't get called.
I tried this #3722 (comment). Still cannot work.
Anyone knows? How to solve this issue?
Reproduction
https://github.com/taganchua/TestApp
Logs
No response
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: