Sentry Integration
I'm currently integrating Sentry reporting and I wanna ask what's the best way to add a function that reports all trpc errors to Sentry
Something like a middleware
https://github.com/trpc/examples-next-prisma-starter/blob/5158b825a2c236e19ef1e7128f86021498fc833c/src/pages/api/trpc/%5Btrpc%5D.ts#L14-L22
I found this but I'm trying to implement it in the API package, not the next js api
packages/api/src/trpc.ts
GitHub
examples-next-prisma-starter/src/pages/api/trpc/[trpc].ts at 5158b8...
🚀 tRPC starter repo with E2E-testing. Contribute to trpc/examples-next-prisma-starter development by creating an account on GitHub.
1 Reply
answer by @marminge moved from ct3a-meta to questions
you make an errorFormatter and then you can use that shape in the onError handler whereever you deploy your app:
alternatively, if you wanna go down the middleware route: