Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Dist script should be named worker.js #681

Closed
sheerun opened this issue Sep 23, 2019 · 3 comments · Fixed by #1063
Closed

Dist script should be named worker.js #681

sheerun opened this issue Sep 23, 2019 · 3 comments · Fixed by #1063
Labels
bug Something isn't working

Comments

@sheerun
Copy link

sheerun commented Sep 23, 2019

🐛 Bug Report

Environment

I'm using newest wrangler 1.4.0-rc.1

Steps to reproduce

The dist file and sourcemap are named main.js and main.js.map, but when using error reporting like sentry it turns out that server-side .js file is names worker.js. Because of this there's filename mismatch and sentry cannot link uploaded sourcemaps to error stacktrace and we get "Source code was not found" error.

What did you expect to see?

If generated file and sourcemap were names worker.js Sentry would would out of the box.

Here's how proper configuration should look like:

  devtool: 'cheap-module-source-map',
  output: {
    path: path.join(__dirname, 'dist'),
    publicPath: 'dist',
    filename: 'worker.js',
    sourceMapFilename: 'worker.js.map'
  },

@xtuc
Copy link
Member

xtuc commented Feb 13, 2020

that's interesting.

Currently, Cloudflare worker hardcodes the name of the script as worker.js, that's why your source map won't match.

@sheerun
Copy link
Author

sheerun commented Feb 13, 2020

In any case Sentry won't work until worker.js is used in sourcemap. I hope you are able to confirm this issue and fix it (you don't need to use my solution).

xtuc added a commit that referenced this issue Feb 14, 2020
`webpack` will by default emit a sourcemap that maps to a `main.js`
file. However, the worker runtime will create the script with a
`worker.js` name. In some cases (like devtools) it doesn't matter
because it resolves the source infos based on the sourcemap `sources`
key. In Sentry for instance, that would fail.

Fixes #681
@xtuc
Copy link
Member

xtuc commented Feb 14, 2020

Implemented your fix in #1063.

xtuc added a commit that referenced this issue Feb 14, 2020
`webpack` will by default emit a sourcemap that maps to a `main.js`
file. However, the worker runtime will create the script with a
`worker.js` name. In some cases (like devtools) it doesn't matter
because it resolves the source infos based on the sourcemap `sources`
key. In Sentry for instance, that would fail.

Fixes #681
xtuc added a commit that referenced this issue Feb 14, 2020
`webpack` will by default emit a sourcemap that maps to a `main.js`
file. However, the worker runtime will create the script with a
`worker.js` name. In some cases (like devtools) it doesn't matter
because it resolves the source infos based on the sourcemap `sources`
key. In Sentry for instance, that would fail.

Fixes #681
xtuc added a commit that referenced this issue Feb 14, 2020
`webpack` will by default emit a sourcemap that maps to a `main.js`
file. However, the worker runtime will create the script with a
`worker.js` name. In some cases (like devtools) it doesn't matter
because it resolves the source infos based on the sourcemap `sources`
key. In Sentry for instance, that would fail.

Fixes #681
xtuc added a commit that referenced this issue Feb 14, 2020
`webpack` will by default emit a sourcemap that maps to a `main.js`
file. However, the worker runtime will create the script with a
`worker.js` name. In some cases (like devtools) it doesn't matter
because it resolves the source infos based on the sourcemap `sources`
key. In Sentry for instance, that would fail.

Fixes #681
xtuc added a commit that referenced this issue Feb 14, 2020
`webpack` will by default emit a sourcemap that maps to a `main.js`
file. However, the worker runtime will create the script with a
`worker.js` name. In some cases (like devtools) it doesn't matter
because it resolves the source infos based on the sourcemap `sources`
key. In Sentry for instance, that would fail.

Fixes #681
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants