Sentry-javascript: "RewriteFrames is not a constructor" when attempting to add sentry to a TypeScript app

Created on 12 Apr 2019  路  10Comments  路  Source: getsentry/sentry-javascript

Package + Version

  • [X] @sentry/browser - "^5.0.6"
  • [ ] @sentry/node
  • [ ] raven-js
  • [ ] raven-node _(raven for node)_
  • [ ] other:

Version:

5.0.6

Description

I followed the guidance in here; https://docs.sentry.io/platforms/node/typescript/ to add Sentry and send source maps from a React + TypeScript app.

I define global.__rootdir__, as the docs suggest, but, and as per the page from the docs, add the following to one of the earliest loaded files;

Sentry.init({
  dsn: '',
  integrations: [new Sentry.Integrations.RewriteFrames({
    root: global.__rootdir__
  })]
});

Now, when starting the app, it gives the following;

UnhandledPromiseRejectionWarning: TypeError: a.Integrations.RewriteFrames is not a constructor

I've also tried removing the whole integrations part from Sentry.init. When I do this, errors get reported correctly, and the "source maps" get uploaded (so I'm satisfied that everything else seems to be working), but the backtraces remain unreadable.

Have I missed something here?

Most helpful comment

Nothing is working out of the box, setup process in unclear and totally broken, source maps uploading is a mess. Sentry is just a waste of time. Spent literally two days and had no success.

All 10 comments

@mtthwhggns we missed docs update, not you, sorry :)

https://docs.sentry.io/platforms/javascript/?platform=node#adding-integration-from-sentryintegrations

tl;dr

import { RewriteFrames } from '@sentry/integrations';

Sentry.init({
  dsn: '',
  integrations: [new RewriteFrames({
    root: global.__rootdir__
  })]
});

I'll update the docs, thanks!

Thank you @kamilogorek

This seems to work perfectly!

@emhagman I should've done it the same time I wrote the comment above 馃槖 Sorry about that.
Fixed - https://github.com/getsentry/sentry-docs/pull/985

No problem, thanks!

Hi!
I had the same issue because there is someplace in the docs where it has not been updated
https://docs.sentry.io/platforms/node/sourcemaps/#updating-sentry-sdk-configuration-to-support-source-maps

Thanks @Heavenston! Updated https://github.com/getsentry/sentry-docs/pull/1089 :)

Module not found: Error: Can't resolve '@sentry/integrations'

@alexeychikk npm install @sentry/integrations

Nothing is working out of the box, setup process in unclear and totally broken, source maps uploading is a mess. Sentry is just a waste of time. Spent literally two days and had no success.

Was this page helpful?
0 / 5 - 0 ratings