Hi,
I’m using the latest Auth0 NextJS SDK with app directory and I’m struggling trying to connect it to TRPC to create protected procedures.
I’m using TRPC’s fetch adapter like this in /api/trpc/[trps]/route.ts
const handler = async (req: NextRequest, res: NextResponse) => {
const session = await getSession(req, res)
return fetchRequestHandler({
endpoint: "/api/trpc",
req,
router,
createContext: () => createContext({ session }),
})
}
export { handler as GET, handler as POST }
I’m trying to pass the session to the context, but getSession function is failing there with the following error.
TypeError: Cannot read properties of undefined (reading 'set')
at Auth0NextResponse.setCookie (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/http/auth0-next-response.js:13:26)
Is there any guide or solution on how to implement this?
Thanks