are httpOnly cookies set in server function available in api routes?
preface with, i'm doing something like this with an existing api route that seems to work, so not sure what's going wrong
i have most of my auth logic in server functions. they basically check jwt in the httpOnly cookie, hit the auth server to refresh if needed, and then reset updated cookies. then that sends back the auth'd user and access token to the client
now, i also have an api route
/apis/sync/push
that needs to read this cookie and authenticate. for some reason when i read the cookie in here i get only undefined.
here's the auth server fn's: https://github.com/jackbisceglia/blank/blob/main/packages/web/src/server/auth/route.ts
they universally all use this shared authenticate method: https://github.com/jackbisceglia/blank/blob/main/packages/web/src/server/auth/core.ts
and here's the push endpoint where the cookie isn't read: https://github.com/jackbisceglia/blank/blob/main/packages/web/src/pages/api/sync.push.ts
admittedly i haven't debugged this too deeply beyond some console logs to see what's going on, but wanted to check if i'm making unexpected use of the framework before i dig in too much3 Replies
unwilling-turquoise•3mo ago
is the browser sending the cookie when calling the api route?
unwilling-turquoise•3mo ago
btw we did quite substantial changes to API routes (now called server routes) on the alpha version. maybe worth trying out
https://github.com/TanStack/router/discussions/2863#discussioncomment-13104960
GitHub
Start BETA - Tracking · TanStack router · Discussion #2863
Tracking any important changes for TanStack Start during the BETA period. If you are coming from the ALPHA of TanStack Start, you can see all the breaking changes that were made here - #2403
adverse-sapphireOP•3mo ago
let me check
yea part of the reason i've been pushing this off is that i plan on adopting the alpha stuff once it's promoted to the main branch
oh i'm an idiot
it's not my client hitting the api route so that's the issue https://zero.rocicorp.dev/docs/custom-mutators#understanding-custom-mutators