Skip to content

HttpClient: Cannot construct a Request with a Request object that has already been used. #7785

Description

@eipc16

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using? If you use the CDN bundles, please specify the exact bundle (e.g. bundle.tracing.min.js) in your SDK setup.

@sentry/react

SDK Version

7.47.0

Framework Version

17.0.2

Link to Sentry event

No response

SDK Setup

Sentry.init({dsn: '<DSN>',debug: true,release: 'local-test',environment: 'local-test',integrations: [newHttpClientIntegration()],});

Steps to Reproduce

I've prepared an example repository that demonstrates this issue: https://github.com/eipc16/sentry-request-object-bug-example. So you can just:

  • git clone git@github.com:eipc16/sentry-request-object-bug-example.git .
  • npm install
  • npm run dev
  • Click on the Fetch with Request Object button

If you do not want to clone this repo then:

  • create a project with '@sentry/react and '@sentry/integrations
  • configure HttpClient integration from @sentry/integrations
  • execute a fetch request by sending to it a whole Request object (it has to have a body). Example:
fetch(newRequest('/api/error',{method: 'post',body: JSON.stringify({property: 'value'})}))

Expected Result

Instrumentation should work and 5XX should result in an event to Sentry

Actual Result

Screenshot from 2023-04-07 09-19-50

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions