Every issue has DELETE,GET,HEAD,PATCH,POST,PUT,OPTIONS,PROPFIND,PROPPATCH,MKCOL,COPY,MOVE,LOCK,UNLOCK,TRACE,SEARCH
Is there an existing issue for this?
- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- [x] I have reviewed the documentation https://docs.sentry.io/
- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
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
const server = Fastify({
maxParamLength: 15000,
trustProxy: true,
logger: {
enabled: CONFIGURATION.verbose,
transport: { target: "pino-pretty" },
},
})
Sentry.setupFastifyErrorHandler(server)
const sentryMiddleware = t.middleware(Sentry.trpcMiddleware({ attachRpcInput: true }))
import * as Sentry from "@sentry/node"
import { nodeProfilingIntegration } from "@sentry/profiling-node"
const isProduction = process.env.NODE_ENV === "production"
const dsn = process.env.SENTRY_DSN
Sentry.init({
environment: isProduction ? "prod" : "dev",
enabled: isProduction,
debug: false,
dsn: dsn,
integrations: [
nodeProfilingIntegration(),
Sentry.httpIntegration(),
Sentry.prismaIntegration(),
Sentry.fastifyIntegration(),
],
tracesSampleRate: 0.05,
profilesSampleRate: 1.0, // This is relative to tracesSampleRate
ignoreErrors: [
"User does not have permission",
"User is not a member of this workspace",
/^No .* found$/,
/BAD_REQUEST|TOO_MANY_REQUESTS|UNAUTHORIZED|FORBIDDEN|NOT_FOUND/,
],
})
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...
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?
I think this issue specifically is no longer happening. So it can be closed. However we're having different issues with v8. Will make a new issue if needed. Thanks!