Hi there,
we’ve used sourcemaps successfully in the past, but some weeks ago they broke for us and I can’t figure out why.
In the error report it says
Source code was not found for webpack:///js.d2ecec009849d87a9e77.bundle.js
{
"url": "webpack:///js.d2ecec009849d87a9e77.bundle.js"
}
I wonder where that webpack:// prefix comes from? The source maps exist and correctly given correctly:
$ tail -n 1 js.d2ecec009849d87a9e77.bundle.js
//# sourceMappingURL=js.d2ecec009849d87a9e77.bundle.js.map
$ file js.d2ecec009849d87a9e77.bundle.js.map
js.d2ecec009849d87a9e77.bundle.js.map: ASCII text, with no line terminators
Sentry also makes a successful (HTTP 200) request to our server.
172.xxx.xxx.xxx - - [02/Mar/2017:21:13:46 +0100] "GET /bundle/js.d2ecec009849d87a9e77.bundle.js.map HTTP/1.1" 200 172 "-" "sentry/8.15.0.dev0 (https://sentry.io)"
What could be wrong here?
Hi Jonas - webpack:/// prefixes get inserted by webpack itself, and they’re references to source code locations inside the sourcemap. (if you look around inside your sourcemap file you should see them listed at the beginning and then referenced again later in the file).
Are your sourcemaps valid locally? (you can check this using the source-map tool on npm, described here: https://docs.sentry.io/clients/javascript/sourcemaps/ )
It seems like -possibly- sentry is correctly scraping the sourcemap from you and then misinterpreting this webpack:/// location and not finding it inside the sourcemap. maybe because of the leading ‘js.’? If it’s easy, you could try changing your pipeline to not have these ‘js.’ prefixes and see if that solves the problem (this is just a hunch). Another question I have is if you’re doing anything special with webpack like chunk splitting.
If you’re a hosted sentry.io customer I can look into this with greater detail if you email support and link one of these affected errors. - Max
Hi Max, thanks for the quick response. I checked with the source-map tool and found that the source maps are entirely empty. It seems like there have been some changes to either webpack or uglify that broke our source map generation. We had to stop using cheap-module-source-map
and had to set sourceMap: true
in our UglifyJS settings. I’m sorry for not checking this before posting to this forum.
For the Sentry side of things, maybe you could provide users with a more helpful error message. If you’re interested in spending time on that I can send you a few example links.
Jonas
no problem, you’re 100% right that our feedback when sourcemaps are broken is confusing and unhelpful (it’s a recurring point of confusion and we’re going to build out some more helpful messaging about it). glad your sourcemaps are working now!
@jonashaag so you’re not using cheap-module-source-map
? What did you use instead?