I can't initialize a session
In this code, I use
useSession
to create a session and initialize it with "light"
if it doesn't have a value:
When I start the application for the first time, or when I manually remove the theme
cookie in the devtools and refresh the page, I get this error:
I don't exactly understand why I get the error. In seems like calling useSession
immediately sends the response to the client, so session.update()
fails because the response is already sent. That's not what expected to happen. Am I doing something wrong?2 Replies
Try adding deferStream to the createAsync, it may at least fix the error
I think updating headers during SSR while streaming isn’t really supported
Thanks,
deferStream = true
fixed the error.