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

"RewriteFrames is not a constructor" when attempting to add sentry to a TypeScript app #2021

Closed
4 of 8 tasks
mtthwhggns opened this issue Apr 12, 2019 · 10 comments
Closed
4 of 8 tasks

Comments

@mtthwhggns
Copy link

Package + Version

  • @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?

@kamilogorek
Copy link
Contributor

kamilogorek commented Apr 12, 2019

@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!

@mtthwhggns
Copy link
Author

Thank you @kamilogorek

This seems to work perfectly!

@emhagman
Copy link

emhagman commented May 14, 2019

The docs are still out-of-date. https://docs.sentry.io/platforms/node/typescript/ I had to Google to find this thread and fix my issue as well. https://github.com/getsentry/sentry-docs/blob/master/src/collections/_documentation/platforms/node/typescript.md

@kamilogorek
Copy link
Contributor

@emhagman I should've done it the same time I wrote the comment above 😒 Sorry about that.
Fixed - getsentry/sentry-docs#985

@emhagman
Copy link

No problem, thanks!

@Heavenston
Copy link

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

@kamilogorek
Copy link
Contributor

Thanks @Heavenston! Updated getsentry/sentry-docs#1089 :)

@alexeychikk
Copy link

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

@kamilogorek
Copy link
Contributor

@alexeychikk npm install @sentry/integrations

@alexeychikk
Copy link

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.

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

No branches or pull requests

5 participants