elifesciences / elife-xpub

eLife is an open-access journal and technology provider that publishes promising research in the life and biomedical sciences. This is their implementation of a submission and peer review system based on Coko PubSweet and xPub.
https://elifesciences.org/
MIT License
32 stars 5 forks source link

Fix newrelic not reporting browser errors #2254

Open erezmus opened 5 years ago

erezmus commented 5 years ago

Follow up from #2237.

At the moment we are using the app/assets/newrelic.js. It might be that it needs updating or that we switch to using the node.js agent.

To test it out locally, one would need to run as in production using node app and configure local reviewer to use newrelic keys (probably need a separate app for local testing on newrelic).

chris-huggins commented 5 years ago

@hdrury1 FYI once you're back. We had HotJar feedback today that somebody couldn't submit, and they shared an error code Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.

Peter says it's not clear what the error is and there was an investigation into getting more useful errors from react. This ticket was raised as a result and I assume might only help us learn more about the error, so I guess we could still have users with this problem until we look into this.

erezmus commented 5 years ago

Added an artificial error to generate the same problem in the frontend. Seems that when running in production mode, no errors are sent to newrelic.

After a lot of trial and error, it turns out that having an ErrorBoundary swallows the erros. They were still visible on development due to react behaviour in development mode as described in https://reactjs.org/docs/error-boundaries.html#component-stack-traces

React 16 prints all errors that occurred during rendering to the console in development, even if the application accidentally swallows them.

So it seems a simple fix is to send the error via the newrelic api

erezmus commented 5 years ago

Screenshot 2019-10-04 at 14 18 30

Can confirm that errors are now being logged in new relic in production mode.

Next bit is getting the source files uploaded

erezmus commented 5 years ago

Still can't seem to be able to upload source maps. Added a ticket on support:

https://support.newrelic.com/tickets/372164/edit