You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm giving stacktrace-js a try in an Angular application that is bundled using webpack. stacktrace-js (or more specifically, stacktrace-gps) is trying to get a .map file from my web server that doesn't exist. Currently, my webpack setup outputs two files at the root of my app's directory:
In my app, I'm trying to use StackTrace.fromError to catch global errors and send them to my web server to be logged:
StackTrace.fromError(exception).then(stackframes=>{StackTrace.report(stackframes,'api/error/myapp','Encountered unhandled error in myapp');}).catch(err=>{$log.error('Unable to get stacktrace from Error object for reporting purposes. '+'No error information has been sent to the server.');});
When an error occurs in my application, stacktrace-js attempts to make a call to https://localhost/myapp/angular-cache.js.map, which doesn't exist. (My app is hosted at https://localhost/myapp/.) As a result, my web server returns a 404 page; stacktrace-gps tries to parse this HTML as JSON (in _parseJson(string) on line 59) and throws an error:
stacktrace-gps.js:59 Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at _parseJson (stacktrace-gps.js:59)
at stacktrace-gps.js:237
at <anonymous>
It's very possible that this is an issue with my setup, but I'm not sure where to begin. My webpack setup seems fairly standard, and I can't seem to find any information online that's relevant to the error I'm getting.
Expected Behavior
When an error occurs, stacktrace-js shouldn't trigger network calls to files that don't exist on my webserver. The only .map file that exists on my web server is myapp.map.js - I would expect that stacktrace-gps would only make a request to get this file. I also don't seem to see a way to configure the name of the .map.js file that stacktrace-gps should fetch from my web server.
Your Environment
stacktrace.js version: 2.0.0
Browser Name and version: Chrome 59/Firefox 54
Operating System and version (desktop or mobile): Windows 10
The text was updated successfully, but these errors were encountered:
I've discovered this issue is the result of one of my dependencies (angular-cache) including its own sourceMappingURL comment in its output:
//# sourceMappingURL=angular-cache.js.map
If I remove this comment from my build's output .js file, this issue seems to be resolved. I'll close this issue since this doesn't seem to be an issue with stacktrace-js (although perhaps this should be mentioned in a FAQ or Troubleshooting section?).
Current Behavior
I'm giving
stacktrace-js
a try in an Angular application that is bundled using webpack.stacktrace-js
(or more specifically,stacktrace-gps
) is trying to get a.map
file from my web server that doesn't exist. Currently, my webpack setup outputs two files at the root of my app's directory:myapp.js.map
looks something like this:My webpack config that generates this map file looks like this:
In my app, I'm trying to use
StackTrace.fromError
to catch global errors and send them to my web server to be logged:When an error occurs in my application,
stacktrace-js
attempts to make a call tohttps://localhost/myapp/angular-cache.js.map
, which doesn't exist. (My app is hosted athttps://localhost/myapp/
.) As a result, my web server returns a 404 page;stacktrace-gps
tries to parse this HTML as JSON (in_parseJson(string)
on line 59) and throws an error:It's very possible that this is an issue with my setup, but I'm not sure where to begin. My webpack setup seems fairly standard, and I can't seem to find any information online that's relevant to the error I'm getting.
Expected Behavior
When an error occurs,
stacktrace-js
shouldn't trigger network calls to files that don't exist on my webserver. The only.map
file that exists on my web server ismyapp.map.js
- I would expect thatstacktrace-gps
would only make a request to get this file. I also don't seem to see a way to configure the name of the.map.js
file thatstacktrace-gps
should fetch from my web server.Your Environment
The text was updated successfully, but these errors were encountered: