Skip to content

breadcrumbCallback - allow to capture request headers/payload/etc #2166

@snebjorn

Description

@snebjorn

This have been requested before in #1490.
Quote

All XHR data (such as request body and headers)

But the proposed solution API doesn't work.

Proposed solution

init({
  dsn: 'https://some.dsn/123',
  beforeBreadcrumb (breadcrumb, hint) {
    if (breadcrumb.category === 'xhr') {
      // hint.xhr is a whole XHR object that you can use to modify breadcrumb
    }
    return breadcrumb;
  }
})

The hint.xhr is a XMLHttpRequest which to my knowledge doesn't have access to the request data. Only the response data.

I understand this isn't included by default due to the 200kb (as of writing) size limit. However the request data is hugely beneficial when debugging an issue.

Please allow us to also capture the request data in the beforeBreadcrumb hook. And perhaps add a function that can check if the breadcrumb have exceeded the size limit so we can strip less relevant data from the breadcrumb.

Also asked here
Sentry Forum
StackOverflow

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions