mozilla / experimenter

A web application for managing user experiments for Mozilla Firefox.
https://experimenter.services.mozilla.com
Mozilla Public License 2.0
120 stars 186 forks source link

404 on CSS source map #3055

Closed pdehaan closed 4 years ago

pdehaan commented 4 years ago

Randomly spotted in devtools console while trying to submit a new Rapido experiment.

Source map error: Error: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Resource URL: https://stage.experimenter.nonprod.dataops.mozgcp.net/static/assets/css/index.css
Source Map URL: /static/assets/index.css.map

https://stage.experimenter.nonprod.dataops.mozgcp.net/static/assets/css/index.css defines the source map at the bottom:

/*# sourceMappingURL=/static/assets/index.css.map */

This 404s https://stage.experimenter.nonprod.dataops.mozgcp.net/static/assets/css/index.css.map, which explains the source map parsing error.

I think the core problem is that the CSS has an invalid path to the source map:

Note that going to https://stage.experimenter.nonprod.dataops.mozgcp.net/static/assets/css/index.css.map directly prompts you to download the index.css.map file, so we know the path is correct.

bhushan-borole commented 4 years ago

Hey @pdehaan I would like to take on this issue. I am facing an issue, in the repo, I can't find index.css.map anywhere

pdehaan commented 4 years ago

@bhushan-borole Yeah, I imagine that the CSS sourcemap is a generated artifact from Webpack/Parcel or something. Let me poke around and see if I can figure out the CSS pipeline and report back (unless somebody else knows off the top of their head and beats me to it).

pdehaan commented 4 years ago

I think maybe the source mapping is happening via Parcel here: https://github.com/mozilla/experimenter/blob/0f4f6bfa8143e2095bc0b6d7d80e812b88d6f201/app/experimenter/static/core/package.json#L76-L77

bhushan-borole commented 4 years ago

So I will have to add the css/ after the /static/assets/ ?

pdehaan commented 4 years ago

@bhushan-borole I dont think so. I think appending css/would break the js/* bundling.

I've been trying to research Parcel CLI and how to configure CSS source maps and haven't found an answer yet, although we could potentially disable source maps via https://parceljs.org/cli.html#disable-source-maps (although not sure if that is too severe).

bhushan-borole commented 4 years ago

I will try disabling source maps, and shoot a PR, let's see if it works out. @pdehaan