React "Production" code doesn't get sent to RavenJS

Seems like RavenJS doesn’t get triggered with unhandled exceptions when running with “Production” (env.config === ‘production’) ReactJS. I am on React version 15.3.2. RavenJS definitely works on non production builds as expected. Anybody run into this?

1 Like

That is odd. It should definitely work because we are running this ourselves with production builds. Can you share how you configure and load Raven?

Sure.

App entry point is main.js where we call the install fn

Raven.config(__SENTRY_KEY__, {
  release: __VERSION__,
  logger: 'consumer-ui',
  tags: {
    build_number: __BUILD_NUMBER__
  }
}).install();

I also use setUserContext if a user is logged in. Other than that, it’s pretty standard. What version of React are you guys on? I read the blog about the minified error handling - https://blog.sentry.io/2016/08/10/react-minified-errors.html.

Webpack build uses UglifyJS, OccurrenceOrderPlugin, and DedupePlugin. Wonder if any of these things messes it up? This is also a Cordova Application. Deploying everything as Cordova App (IOS/Android) works fine with a non production flag though.

UglifyJS is known to cause problems. We got a few reports about this but usually it’s just the sourcemaps pointing to wrong locations so your events should still show up. We’re on 15.3.2 at the moment.

Here are the two different logs from each environment with the same breaking use case.

Error log from staging:

[Error] TypeError: undefined is not an object (evaluating 'e.lets.breakthis')
n (app.f76e5c221bccc8c55466.js:157:26616)
dispatchEvent

Error log from production:

TypeError: undefined is not an object (evaluating 'e.lets.breakthis') 
 rethrowCaughtError — ReactErrorUtils.js:52