2
donuts
32d

I have a Angular webapp that's minified in production. And it's throwing an error thought it seems to get caught by a catch-all and relayed to a toast message.

Is there anyway to trace it back to the source code?

Comments
  • 1
    I think you can tell either chrome or Firefox Dev tools to break on caught exceptions.
  • 0
    @spongessuck but how do I know where that is in the source code? The webapp is huge.
  • 3
    Sourcemap?
  • 2
    Use the npm package http-server (global install)

    Run your ng build —prod —apt command, but specifically remove the “minify” from your angular.json settings

    After build, run the server in the folder it built to, and replicate the issue. You should locate it easier like this. It’s a trick I use a LOT whenever I get prod-only problems
  • 2
    Mitm debugging is best option here:

    1. Install a proxy
    2. Intercept all js requests originating in the browser from your app domain
    3. Serve a non-minified local version based on the prod build
    4. Win

    If you're writing web applications, it is in your best interest to be adept at manipulating network traffic
  • 1
    @billgates

    Let me know if you need help. I have my discord on my profile if you need a quicker response time than on here
  • 1
    @jschmold thanks, it's actually not urgent at the moment. Whatever the problem was I couldn't reproduce locally so just restarted the server... So hopefully that fixes it for.

    Have other projects need to finish. But was just wondering if there was an easy way.
  • 1
    I mostly work with Java and the non web projects but get pulled into production issues when other ppl can't figure it out... Cuz I'm the "expert" at fixing things... That other ppl fckd up...
  • 1
    @jschmold actually I was able to replicate the issue on my local now which has the source code so that is unminified. And I can trace it now.

    But say like before this issue only happens in prod for certain users. Seems the only way would be to point a local instance of the app unminified, to prod and tell the user to replicate it on that server?
  • 1
    @billgates
    Pretty much. Angular is fantastic for stupid intermittent colossal breaks because of a data problem
  • 1
    @jschmold compound that with lazy/novice devs that write shit code usually copied from other shit code
Add Comment