Skip to content

beforeBreadcrumb can no longer access original Request object in v8 #12132

Closed
@TheHolyWaffle

Description

@TheHolyWaffle

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.2.1

Framework Version

No response

Link to Sentry event

No response

SDK Setup

Sentry.init({
    dsn: '....',
    beforeBreadcrumb: beforeBreadcrumb,
    enableTracing: true,
    sampleRate: 1,
    integrations: [Sentry.httpIntegration(), Sentry.nativeNodeFetchIntegration()],
});


export function beforeBreadcrumb(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): Breadcrumb | null {
    if (breadcrumb.type !== 'http' || breadcrumb.category !== 'http' || !hint) { // <---- hint is undefined here
        return breadcrumb;
    }
    // .....
}

Steps to Reproduce

  1. Make an native node fetch api call
  2. Throw an error so that beforeBreadcrumb is triggered

Expected Result

The beforeBreadcrumb handler should receive the original fetch Request object as a hint parameter. This is used to extract the fetch request headers and apply this information to enrich the breadcrumb.

Actual Result

The beforeBreadcrumb handler does not receive the original fetch Request object anymore since Sentry v8

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nodeIssues related to the Sentry Node SDK

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions