Merged in fix/capture-errors-in-trpc (pull request #2103)

Fix/capture errors in trpc

* fix: import @sentry/nextjs, not @sentry/node

* add sentry logging for errors in trpc


Approved-by: Linus Flood
This commit is contained in:
Joakim Jäderberg
2025-05-16 11:44:25 +00:00
parent 24e7ab4b71
commit ec29664a60
2 changed files with 15 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
import * as Sentry from "@sentry/nextjs"
import { TRPCError } from "@trpc/server"
import { redirect } from "next/navigation"
@@ -49,6 +50,19 @@ export function serverClient() {
redirect(redirectUrl)
}
}
Sentry.captureException(error, {
extra: {
input,
path,
type,
url: ctx?.url,
lang: ctx?.lang,
pathname: ctx?.pathname,
contentType: ctx?.contentType,
uid: ctx?.uid,
},
})
},
})
}

View File

@@ -1,4 +1,4 @@
import * as Sentry from "@sentry/node"
import * as Sentry from "@sentry/nextjs"
import { initTRPC } from "@trpc/server"
import { experimental_nextAppDirCaller } from "@trpc/server/adapters/next-app-dir"
import { ZodError } from "zod"