sentry-javascript: capturing axios error breaks internal Stream node object

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

4.6.2

Description

Axios is widely used library for http requests - both in browsers and node. Unfortunately combination of axios and sentry can very well break some of the node internals.

Problem is that axios attaches request and response objects to the error and sentry is attempting to somehow serialize that which as side effect breaks Stream object in Node. There might be more broken but that was the one I encountered. And was very tricky to identify it… sentry was not among the suspects. Latest axios version has toJSON method on error to get something more serialisable… so that might be option to address that.

Here is reproducible demo. Just fill in the dsn in index.js and do npm install && npm start. https://github.com/jardakotesovec/sentry-axios-bug

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

@rchl have you installed ExtraErrorIntegration? Since v5 it’s optional one.

import * as Sentry from '@sentry/node';
import { ExtraErrorData } from '@sentry/integrations';

Sentry.init({
  dsn: '...',
  integrations: [new ExtraErrorData()]
});

@kamilogorek Tested and looks good. Thanks a lot for quick and spot on support.