Unable to use setHeader on response object from trpc context (using app router)

I'm trying to set a JWT cookie in a login mutation in a router, here's the code snippet I'm using to try set the token ctx.res.setHeader( "Set-Cookie", cookie.serialize("user-token", token, { httpOnly: true, path: "/", secure: env.NODE_ENV === "production", }), ); however in the console I receive this error ❌ tRPC failed on auth.login: Cannot read properties of undefined (reading 'setHeader') would anyone else happen to be knowledgeable on this thanks
1 Reply
UncleBen
UncleBen6mo ago
Would be happy to share the whole router file if needed