Error validating sourcemap using https://raygun.com/validatesourcemaps

broth

Posted on
Aug 17 2016

I am having the exact same issue as reported here: https://raygun.com/forums/thread/47508#58773

Source map comments were not detected in the following minified files. 
Please ensure your minified files include the "//# sourceMappingURL=..." comment on a separate line at the end of your file.
https://xxxxx.herokuapp.com/app/resources.js:1:71), <anonymous>

I also just came across RayGun's Source Map Validator (https://raygun.com/validatesourcemaps) but when I validate my sourcemap file, it gives a nondescript error:

Ensure the source map contains a valid "sources" property

Here is the head of my sourcemap file:

{"version":3,"file":"main-built.js","sources":["main-combined.js"],"names":["requirejs","require","define",...

My minified file is, main-built.js, my combined source file is, main-combined.js. I generated my files via uglify-js just as the instructions suggest (uglifyjs main-combined.js -o main-built.js --source-map main-built.js.map), so I'm not sure what else it wants or what might be wrong.

Thanks, Bob


Alex

Posted on
Aug 17 2016

Hi Bob,

Thanks for reporting the problem. It looks like this issue is unrelated to the thread you linked. There is actually an issue with the map file which isn't specifically handled by our validator resulting in an incorrect error report.

The problem is the "names" array (within the sourcemap) contains an object instead of a string (at column 85039). This occurs due to an apparent issue with Uglify (or it's dependencies) which I believe may occur if you minify a file which uses JavaScript getters and setters.

I reported this issue a while ago here: https://github.com/mishoo/UglifyJS2/issues/731

I'll investigate a solution or workaround for this case for our validator and mapping service (to possibly ignore the issue - as it's hard to work around on your end) and get back to you once we've deployed this.

Thanks,
Alex


broth

Posted on
Aug 18 2016

Hi Alex,

Thanks for your quick reply. We do use Javascript getters and setters in our code, but it sounds like the source map is valid, it's just the validator has trouble handling it. Is that correct, since the the other problem I am having appears to be unrelated to it?

As for the other problem I linked to, I have one more thing I am going to try but after that, I am at a loss to a solution to getting the source maps completely working. I say completely, because we're at least now getting class names listed on our errors now, but the line numbers are still based on the minified code.

Thanks, Bob


Alex

Posted on
Aug 18 2016

Hi Bob,

Just letting you know we've added some handling for this case into our validator. The issue seems to be fixed in the latest version of UglifyJS2 however so I'd recommend updating that as well.

I've sent you an email regarding your second issue.

Cheers,
Alex


Reply