0

When running ng serve -prod, the run is obfuscated to reduce the size and hide the code. This is causing an issue in crash reporting tools (tried sentry and raygun) since the crash report is obfuscated. Is there any solution to get a clear crash report? Can we upload some kind of file to show the real code just like the dSYM in iOS?

Estus Flask
  • 206,104
  • 70
  • 425
  • 565
Tarek A.
  • 218
  • 2
  • 12

1 Answers1

1

Yes, there is an answer. It's called source maps. Note, I'm from Raygun, just to be clear :)

Source maps provide the smarts to 'unwind' the minification, merging and obfuscation.

Raygun supports this many different ways:

  1. We automatically will try to fetch the file from your server (likely won't work here since you're trying to keep it secret)
  2. You can send the source map file when you do the build to our API. Raygun and you will have the ability to process the source map with the crash report, keeping it secret from others but giving you human readable stack traces. This happens automatically when Raygun processes the raw crash report.
  3. Lastly, but not scalable, is that you can manually upload a source map in the 'source map center' in Raygun (under the Crash Reporting side bar item). I don't recommend it long term because it's easy to forget to do it, however it should help with testing.

Lastly, most of the tools that do obfuscation, merging and minification will have a flag you can provide that instructs it to generate a source map file alongside your javascript file.

If you have any issues and are using Raygun, shoot us a note in the app with the 'Contact Raygun' link -- we've seen almost every weird issue that can exist in source maps :)

You can read more about how Raygun manages source maps here: https://raygun.com/docs/workflow/source-maps

I hope that helps.

traskjd
  • 1,008
  • 5
  • 7