Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpClient integration does not capture Axios requests #7615

Closed
3 tasks done
hckhanh opened this issue Mar 26, 2023 · 4 comments · Fixed by #7714
Closed
3 tasks done

HttpClient integration does not capture Axios requests #7615

hckhanh opened this issue Mar 26, 2023 · 4 comments · Fixed by #7714
Assignees

Comments

@hckhanh
Copy link

hckhanh commented Mar 26, 2023

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

Framework Version

React 18.2

Link to Sentry event

No response

SDK Setup

import {
  ErrorBoundary,
  Replay,
  init as initSentry,
  Integrations,
} from '@sentry/react'
import { BrowserTracing } from '@sentry/tracing'
import {
  HttpClient as HttpClientIntegration,
  Debug as DebugIntegration,
} from '@sentry/integrations'

initSentry({
  dsn: __SENTRY_DSN__,
  release: __SENTRY_RELEASE__,
  dist: __SENTRY_DIST__,
  environment: import.meta.env.MODE,

  // debug: true,
  enabled: true,
  integrations: [
    new BrowserTracing(),
    // new Integrations.
    new Replay({
      maskAllText: false,
      maskAllInputs: false,
      blockAllMedia: false,
    }),
    new HttpClientIntegration({
      // failedRequestStatusCodes: [401],
      // failedRequestTargets: ['http://localhost:3005'],
    }),
    new DebugIntegration({
      // // trigger DevTools debugger instead of using console.log
      // debugger: true,
      // // stringify event before passing it to console.log
      // stringify: boolean;
    }),
  ],

  tracesSampleRate: 1,
  replaysSessionSampleRate: 1,
  replaysOnErrorSampleRate: 1,
})

Steps to Reproduce

When I add HttpClient, it cannot report XHR request. I am using Axios v1

Expected Result

it will report XHR requests

Actual Result

It don't report any XHR requests. Even though the exception pointed directly to _wrapXHR function of Sentry

image

image

@mydea
Copy link
Member

mydea commented Mar 27, 2023

Hello,

thanks for writing in!
I can reproduce that this does not seem to be working with axios. I would guess it's because of order of monkey patching things, or similar. I wrote a reproduction where you can see it failing: edaa015

Backlogging this for now, as we have a lot of stuff on our plates. PRs are welcome if anybody got time to work on this before!

@jacob-mako
Copy link

Given the popularity of axios it would be nice to see this fixed.... We're using axios in a pretty vanilla fashion (modulo some use of interceptors) and it appears pretty broken

@mydea mydea changed the title HttpClient cannot report XHR Requests (Axios) HttpClient integration does not capture Axios requests Mar 31, 2023
@mydea mydea self-assigned this Apr 3, 2023
@mydea
Copy link
Member

mydea commented Apr 4, 2023

Hey,

we have merged a fix for this, which will go out with the next release! Thanks again for reporting this.

@mydea
Copy link
Member

mydea commented Apr 7, 2023

Just FYI, we have released 7.47.0 which should fix this issue!

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

Successfully merging a pull request may close this issue.

3 participants