Next.js Discord

Discord Forum

Cookies in tRPC

Unanswered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
I have set up a project using create-t3-app that uses tRPC. If I use import { cookies } from "next/headers";in my procedures, I am not able to get or set any cookies.

I assume this is because Nextjs does not allow usage of cookies outside of server components, server actions and route handlers.

But aren't all tRPC procedures turned into route handlers at /api/trpc?

Am I misunderstanding something? How can I use cookies in my procedures? Has anyone set up a project like so?

0 Replies