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
but when i try accessing it on trpc server request the cookie is empty this is my
server.ts
// not seeing the set cookie here. I am sure it is sent because on route handler request in my next route i have access to it
import "server-only";
import { cache } from "react";
import { cookies, headers } from "next/headers";
import { createCaller, createTRPCContext } from "@repo/api";
/**
* This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when
* handling a tRPC call from a React Server Component.
*/
const createContext = cache(() => {
console.log(cookies()) // not seeing the set cookie here. I am sure it is sent because on route handler request in my next route i have access to it
const heads = new Headers(headers());
heads.set("cookies", cookies.toString());
return createTRPCContext({
headers: heads,
});
});
export const api = createCaller(createContext);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
i am setting my cookie in after login like this in my login router
but when i try accessing it on trpc server request the cookie is empty this is my
server.ts
// not seeing the set cookie here. I am sure it is sent because on route handler request in my next route i have access to it
and this is my context
Beta Was this translation helpful? Give feedback.
All reactions