Embedded Angular Applications
RGUser123
Posted on
Nov 27 2019
Hello!
Our current setup is an ASP.NET site with multiple angular (v8) applications embedded into it.
I've followed the setup documentation and integrated raygun crash reporting and real user monitoring into each of these applications, which on testing return exceptions as expected.
I've also seperately integrated raygun crash reporting and real user monitoring (using the javascript approach in your documentation) into the main ASP site and this works as expected as well, logging errors from the site (but not within the individual apps).
However, when both sets of logging are active, the site logs errors and any errors thrown during app initialisation (e.g. during ngOnInit) are logged, but elsewhere in the apps it fails to log thrown errors.
I suspect that there is some kind of conflict between the javascript and angular raygun integrations that is causing it to silently not log in the background (no console errors to provide clues). Is this the correct approach or should I have a single raygun application integrated into the ASP site, which the anguar apps can feed into, preventing any integration conflict?
Thanks
Deleted User
Raygun
Posted on
Nov 27 2019
Hi,
Yes, you are correct there will be a conflict. Our recommendation would be to keep the basic JavaScript integration by keeping the inclusion of raygun4js in the head of the page. Then remove the angular imports of raygun4js in the applications. You can still manually report errors and track page events using the global variable, window.rg4js. Please try this and let us know how you get on.
Cheers, Mitchell.
RGUser123
Posted on
Nov 29 2019
Hi Mitchell,
Following your advice I've removed the raygun integration from each of the angular apps and updated the custom error handler for these apps to send events to the instance of rg4js on the window object and this works a treat.
Thanks for the assist!
Cheers, Mat
Deleted User
Raygun
Posted on
Nov 29 2019
Hi Mat,
Glad to hear the problem is resolved. Reach out again if you encounter any more issues.
Cheers, Mitchell