Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

Feature Idea: Browser snippet to include New Relic is failing due to lack of strict mode support



To install browser monitoring, New Relic provides a script that I can copy/paste into my site.I recently upgraded to Angular 8.1.1 and discovered that that snippet is failing.

Angular now enforces strict mode, while the NR snippet does not respect strict mode. I’d get an error, Uncaught ReferenceError: NREUM is not defined. I started stepping through the code and converting it myself, eg.

window.NREUM || (NREUM = {}) becomes window.NREUM || (window.NREUM = {}) etc

but ended up quitting when I got to some minified code,

Uncaught TypeError: Cannot assign to read only property 'prototype' of function 'function Promise() { [native code] }' at f.prototype = Object.create(f.prototype, {constructor: {value: r}}), s(Object.getOwnPropertyNames(f), function (t, e) {

Can we please get a strict-mode compatible version of the browser javascript snippet?


New Relic edit

  • I want this, too
  • I have more info to share (reply below)
  • I have a solution for this

0 voters

We take feature ideas seriously and our product managers review every one when plotting their roadmaps. However, there is no guarantee this feature will be implemented. This post ensures the idea is put on the table and discussed though. So please vote and share your extra details with our team.


Hi @adavenport! The functionality you described above is not currently supported out of the box by New Relic. It will make for an interesting idea to be passed along! I am happy to do that for you now.

Also, please vote in the poll I have created above! This will allow other Explorers who may benefit from this to also vote, share use cases, or discuss possible workarounds! Thanks for bringing it up! :blush:


We found the same issue when adding the browser SPA script on ours VueJS widgets, this post helped a lot to understand what was happening and we created a ticket on New Relic Support. While we wait for their response we fixed the exception that is listed aboved like this:

  // This assignment is throwing an exception because 'use strict' does not
  // allow the property assignment like this.
  //   f.prototype = Object.create(f.prototype, {
  //       constructor: {
  //           value: r
  //       }
  //   }),
  // To solve it, we propose this solution but we are not sure it is behaving the 
  // same way than the original, so if the promises raise errors, review this section
  // BEGIN of solution
  Object.defineProperty(f, 'prototype', {
    constructor: {
        value: r,
  // END of solution

It’s a workaround while we wait for support from new relic but for now is working for us. I hope it helps.



Thanks for sharing that @halty.maximo :smiley: