Open divmgl opened 1 week ago
Hi @divmgl thanks for reaching out.
First thing, since you're on v8 you can get rid of Sentry.httpIntegration()
(it's enabled by default) and Sentry.fastifyIntegration()
(not needed anmore for the Fastify setup).
Do you have any special errorFormatter
logic in your trpc initialization?
@chargome btw, removing Sentry.setupFastifyErrorHandler(server)
fixed the issue for us.
We do have a special error formatter.
export const t = initTRPC
.meta<OpenApiMeta>()
.context<TRPCContext>()
.create({
transformer: superjson,
errorFormatter({ shape, error }) {
const isNotFoundError =
error.cause &&
error.cause instanceof PrismaClientKnownRequestError &&
error.cause.code === "P2025"
const message = handleBadRequestErrors(error)
if (isNotFoundError) {
return merge(shape, {
data: {
code: "NOT_FOUND",
httpStatus: 404,
stack: error.stack,
},
}) satisfies DefaultErrorShape
} else if (message) {
return merge(shape, {
message,
code: TRPC_ERROR_CODES_BY_KEY.BAD_REQUEST,
data: {
code: "BAD_REQUEST",
httpStatus: 400,
stack: error.stack,
},
}) satisfies DefaultErrorShape
}
return shape
},
})
Nothing too crazy.
Good to hear that you could fix that issue by removing setupFastifyErrorHandler
🙌 Do you still face issues or can this be closed?
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.34.0
Framework Version
No response
Link to Sentry event
https://permitflow.sentry.io/issues/5999574154/?environment=prod&project=4504595707396096&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&statsPeriod=1h&stream_index=0
Reproduction Example/SDK Setup
Steps to Reproduce
I'm not sure how else to specify this. I installed the latest verison, and set it up as per the docs and I'm getting this spam.
Expected Result
The error messages are preserved.
Actual Result
I get
DELETE,GET,HEAD,PATCH,POST,PUT,OPTIONS,PROPFIND,PROPPATCH,MKCOL,COPY,MOVE,LOCK,UNLOCK,TRACE,SEARCH /trpc/:path
on almost every Sentry issue...