Request data not consistent between createServerData$ and API route
I have a lucia x trpc x solidstart project setup.
TLDR: I'm observing that the
event
event
passed to my
createServerData$
createServerData$
and the
event
event
that is passed to my API handler is different.
Here's my project structure:
src|--auth|--routes| |--(auth)| | |--login.tsx <-- this one has access to the right cookie| |-- api| | |--trpc| | | |--[trpc].ts <-- this one does not have access to the cookie even though login.tsx already has|--api
src|--auth|--routes| |--(auth)| | |--login.tsx <-- this one has access to the right cookie| |-- api| | |--trpc| | | |--[trpc].ts <-- this one does not have access to the cookie even though login.tsx already has|--api
Here's how my API handler for trpc has been setup
src/routes/trpc/[trpc].ts
src/routes/trpc/[trpc].ts
const handler = async ({ request, params }: APIEvent) => { const cookie = parseCookie(request.headers.get("Cookie") ?? ""); console.log(cookie); <-- this logs as {} };export const GET = handler;export const POST = handler;
const handler = async ({ request, params }: APIEvent) => { const cookie = parseCookie(request.headers.get("Cookie") ?? ""); console.log(cookie); <-- this logs as {} };export const GET = handler;export const POST = handler;