You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting up a project with SvelteKit Session Cookie and Houdini i ran into some problems and it took me a while to find a working setup.
If is setup +layout.svelte.ts as recommended:
/** @type {import('./$types').LayoutServerLoad} */exportconstload=({ locals })=>{return{session: locals.session.data// You can also use your old `getSession` function if you wish.};};
The houdini client receives an empty session object.
In order to solve this, I have to extent hooks.server.ts
import{handleSession}from'svelte-kit-cookie-session';import{sequence}from'@sveltejs/kit/hooks';import{setSession}from'$houdini'constsessionHandler=handleSession({secret: 'YOUR_SECRET_KEY'})exportconsthandle=sequence(sessionHandler,({ event, resolve })=>{setSession(event,event.locals.session.data)//otherwise houdini will not get the sessionreturnresolve(event)})
Now queries work, but for mutations the client is still receiving empty session objects.
To fix this i have to manually reset __houdini__session in +layout.server.ts:
Setting up a project with SvelteKit Session Cookie and Houdini i ran into some problems and it took me a while to find a working setup.
If is setup +layout.svelte.ts as recommended:
The houdini client receives an empty session object.
In order to solve this, I have to extent hooks.server.ts
Now queries work, but for mutations the client is still receiving empty session objects.
To fix this i have to manually reset __houdini__session in +layout.server.ts:
Any ideas why the recommended implementation isn't working!?
The text was updated successfully, but these errors were encountered: