getSession return null, but only when deployed
Hello,
im building an application right now.
frontend: sveltekit on cf worker
backend: hono on cf worker
On local development everything works as expected.
When I deploy the apps to cloudflare and try get the session via authClient.getSession() i get null in return.
On my local dev environment I get the session and user objects as expected.
I checked cors but thats not the problem, because i recieve all the calls on the backend with code 200
14 Replies
The calls on the backend:
POST https://app.mydomain.com/api/auth/sign-in/email - Ok @ 6/10/2025, 5:18:09 PM
GET https://app.mydomain.com/api/auth/organization/list - Ok @ 6/10/2025, 5:18:12 PM
GET https://app.mydomain.com/api/auth/organization/list - Ok @ 6/10/2025, 5:21:33 PM
GET https://app.mydomain.com/api/auth/organization/list - Ok @ 6/10/2025, 5:21:52 PM
GET https://app.mydomain.com/api/auth/organization/list - Ok @ 6/10/2025, 5:23:52 PM
ok looks like getSession works in layout.ts but not layout.server.ts when i deploy it
but locally it works?
i have same issue , only with social providers
have you tried with +page.ts or +page.server.ts instead ?
maybe not too useful, but worth a shot: Are all the correct env vars set?
Have checked cross sub domain cookies? or just cookies section in general?
i think the problem is with cookies, in production the cookies is not setting after the sign up
Got it working. I moved all into the sveltekit project now i can use auth.api
i also have the same problem with google sign in, cookies arent being set. did you find a solution for this @rinshad @louis
Whats ur stack? @stormej
nextjs on the frontend and hono bun backend
useSession and getSession return run but only when i do it on prod
did you ever solve this?. facing the same thing, not sure what im doing wrong
No moved to making a flutter app, writing my own api calls and cookie management
What about you @ahmadaccino found a fix?
i migrated my app to clerkðŸ˜