netlify / angular-runtime

The Angular Runtime allows Angular to run on Netlify with zero configuration
https://docs.netlify.com/integrations/frameworks/angular/
MIT License
19 stars 11 forks source link

Sentry integration #144

Open daroczig opened 3 months ago

daroczig commented 3 months ago

Is your feature request related to a problem? Please describe.

It's difficult to debug Angular SSR errors on Netlify Edge.

Sometimes, we see odd errors in the SSR Edge Function logs, e.g.:

Jun 25, 12:10:36 AM: 01J164T3 error  [Angular SSR] ERROR TypeError: Cannot read properties of undefined (reading 'get')
    at ho (file:///root/dist/sc-www/server/chunk-WQQCIBV7.mjs:193:2619)
    at e.ngOnInit (file:///root/dist/sc-www/server/chunk-WQQCIBV7.mjs:198:124362)
    at Yd (file:///root/dist/sc-www/server/chunk-L7LMYR6S.mjs:8:10817)
    at KD (file:///root/dist/sc-www/server/chunk-L7LMYR6S.mjs:8:10963)
    at Ph (file:///root/dist/sc-www/server/chunk-L7LMYR6S.mjs:8:10724)
    at ai (file:///root/dist/sc-www/server/chunk-L7LMYR6S.mjs:8:10452)
    at VE (file:///root/dist/sc-www/server/chunk-L7LMYR6S.mjs:8:41439)
    at sc (file:///root/dist/sc-www/server/chunk-L7LMYR6S.mjs:8:42495)
    at jE (file:///root/dist/sc-www/server/chunk-L7LMYR6S.mjs:8:41038)
    at $p (file:///root/dist/sc-www/server/chunk-L7LMYR6S.mjs:8:40931)

It runs fine when running the Angular app on localhost (with Express), but fails on Edge. After painful shotgun debugging, we managed to figure out what is undefined on Edge, and made adjustments in our codebase, but it would be much easier to get a proper traceback.

We tried to compile with source maps, but that did not improve the above traceback.

A potential solution might be submitting the error to Sentry where we can upload the source maps.

Describe the solution you'd like

It would be great to see a full traceback for debugging purposes. It could be in the Edge logs, or Sentry.

Describe alternatives you've considered

I don't think we can solve this without updates in angular-runtime. We tried to compile source maps in the PR preview deployments, but did not help the readability of the above traceback.

Additional context

See the above example error.