Svelte Kit hooks.server.ts getSession not working
I want to use better-auth with SvelteKit, but I don't use the
This is because it uses two Cloudflare Workers, one running the server and the other just a proxy.
Now i want to use inside
The cookie inside
I think I'm maybe missing some setup, which is needed if I use a custom api route and note the
svelteKitHandler.. I've set-up a custom route apps/frontend/src/routes/api/auth/[...all]/+server.ts with the following code:This is because it uses two Cloudflare Workers, one running the server and the other just a proxy.
Now i want to use inside
hooks.server.ts the following codeThe cookie inside
event.request.headers does include the etter-auth.session_token=, but it still always return null.. I can't use auth.api.getSession because the auth instance runs in a different worker, but according to the docs it should work with https://www.better-auth.com/docs/reference/faqI think I'm maybe missing some setup, which is needed if I use a custom api route and note the
svelteKitHandler, but I'm a bit lost. Can anyone help?