Skip to content

Nitro: Errors are reported twice #24939

Description

@MickL

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nitro

SDK Version

11.1.0

Framework Version

11.1.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

Handler /routes/sentry.ts from the docs:

import { defineHandler } from 'nitro/h3';

export default defineHandler(() => {
  throw new Error('Sentry error tracing is working!');
});

Expected Result

  • Should report one error to Sentry
  • Specific errors like 401 should not be reported to Sentry

Actual Result

  • Errors show up twice in Sentry, once as Error and once as HttpError
  • Specific errors like 401 are reported to Sentry (once) as HttpError

Additional Context

Found that @sentry/nitro reports errors from two places: The error hook (which filters 4xx) and the h3 tracing channel (which doesn't), causing duplicate reports and letting the 401 slip through unfiltered.

Priority

Critical ?

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions