Integrating Sentry with the t3 stack (v8 edition) #13103
lforst
started this conversation in
Show and tell
Replies: 2 comments 4 replies
-
Will the client errors also have the context of the user that was set in the signIn and signOut events of next-auth ? |
Beta Was this translation helpful? Give feedback.
2 replies
-
How could we ignore certain errors using this approach? Maybe manually captureException in the tRPC onError callback instead of the middleware so we get more control? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is a small guide on how to integrate Sentry with https://create.t3.gg/. This guide is a successor to the original guide written by @AbhiPrasad.
Initial Setup
First, create your test app with
npm create t3-app@latest
.Next, follow our Next.js SDK setup guide by running
npx @sentry/wizard@latest -i nextjs
. This will configure and install our Next.js SDK with the appropriate Sentry project.You can test this out by running
npm run dev
and checking out http://localhost:3000/sentry-example-pageNow depending on what you've added, use our optional integrations/setup.
Optional setup
Prisma
If you've configured prisma, add the Sentry Prisma integration to your
sentry.server.config.ts
file.Also, make sure to enable the
tracing
feature flag in thegenerator
block of your Prisma schema:generator client { provider = "prisma-client-js" + previewFeatures = ["tracing"] }
NextAuth.js
If you've set up
nextAuth
, you can configure it's events to attach information to Sentry. For example below I've updatedsrc/server/auth.ts
to set the user on sign in. You can also create Sentry breadcrumbs on the different events emitted.tRPC
If you're using tRPC, you can set up Sentry's tRPC middleware by updating
src/server/api/trpc.ts
to extend your procedure withSentry.trpcMiddleware()
.Beta Was this translation helpful? Give feedback.
All reactions