Session trace and external JS asset that fails to load

  • Share what method you used to deploy Browser (APM or copy/paste):
    APM

  • Which version are you using? (Lite, Pro or SPA):
    Browser Pro

I have an AngularJS app that sometimes fails to load for a small percentage of our users. In NewRelic this shows as a JS error “angular is not defined” which is triggered during a small inline script at the end of the HTML. The HTML has five script tags in the body referencing external JS libraries. Four of these, including the one containing AngularJS, are hosted on a CDN. None of the script tags have defer or async attributes.

In the available session traces, I see two basic patterns, both reported on Mac Chrome 67, but there are other Chrome versions and Safari versions in which this has occurred:

  1. CSS from the CDN and JS from the non-CDN library show as having loaded (green bar), but there is no information shown about the CDN JS assets. If the browser failed to load them, e.g. due to local network configuration or conditions, or CDN outage, would that be reflected in the session trace? Is it possible they loaded but did not execute?
  2. All CSS and JS assets loaded but Angular is still not defined. Is there any other NewRelic information that can help determine why that is happening?

Would calling noticeError from a script.onerror handler provide information about failed asset loads?

Hi @redwood - You may want to look at the post below on a potential implementation to insert a custom event based on the exception you are noticing. Modify for your use case.

1 Like