Integrate Auth0 NextJS SDK with TRPC to create protected procedure

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

Any luck solving this?

I also have issues integrating the Auht0 NextJS SDK with tRPC :confused:

I haven’t good vibes also.