After upgrading to Chrome 49 I noticed a message in the devtools console saying it couldn’t parse my sourcemaps. Here are some things to check when your sourcemaps are bad.

Is the sourcemap served with correct headers?


If the sourcemap is gzipped, it needs a proper Content-Encoding response header so the browser can handle it:

Content-Encoding: gzip

I couldn’t get Chrome devtools to show the sourcemap response headers so I downloaded the sourcemap directly in Firefox and checked the devtools there.

Detecting if sourcemap is gzipped

Download the sourcemap and run

$ head -c 2 <sourcemap> | hexdump -ve '1/1 "%02x" "\n"'

If this prints


which is the gzip magic number, the sourcemap is gzipped.

Or just look at the sourcemap contents

$ more <sourcemap>

If it looks like binary data, it’s probably gzipped. If it looks like json, it isn’t.

What about Content-Type?

The Content-Type of sourcemaps doesn’t matter. Seems like browser devtools know they’re getting a sourcemap when downloading from a url specified by sourceMappingURL.

Is the sourcemap valid?

Sourcemaps are json so make sure it’s valid json and not just an empty object.

Next step is reading the docs of whatever tool the sourcemap was generated by and double checking your usage of it.