Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web worker initialization is throwing 404 error #26144

Closed
rishimohan opened this issue Jun 15, 2021 · 2 comments · Fixed by #26256
Closed

Web worker initialization is throwing 404 error #26144

rishimohan opened this issue Jun 15, 2021 · 2 comments · Fixed by #26256
Labels
bug Issue was opened via the bug report template.

Comments

@rishimohan
Copy link

What version of Next.js are you using?

11

What version of Node.js are you using?

12.18.3

What browser are you using?

Safari

What operating system are you using?

macOS Monterey

How are you deploying your application?

Netlify

Describe the Bug

I just upgraded to Next.js v11. On first load I got the following error:

2021-06-16 at 00 35

After some debugging I found out that it's happening at:

workerRef.current = new Worker(new URL("workers/loadFeed.js", import.meta.url));

The file is at /workers/loadFeed.js.

My next.config.js configuration:

module.exports = {
  target: "experimental-serverless-trace",
  webpack: (config, { isServer, webpack }) => {
    config.output.hotUpdateMainFilename =
      "static/webpack/[fullhash].[runtime].hot-update.json";
      config.optimization.splitChunks.chunks = "all";
      
      if (!isServer) {
        config.resolve.fallback.fs = false;
    }

    return config;
  },
};

It was working fine with last release version. Seems like issue with initialisation or something that's change in 11.

Expected Behavior

The worker should be initialized instead of throwing 404 error.

To Reproduce

1: npx create-next-app
2: create a simple web worker in root of folder /worker.js
3: Try to intiialize the web worker using:

workerRef.current = new Worker(new URL("worker.js", import.meta.url));

@rishimohan rishimohan added the bug Issue was opened via the bug report template. label Jun 15, 2021
@timneutkens
Copy link
Member

Duplicate of #26152

@timneutkens timneutkens marked this as a duplicate of #26152 Jun 17, 2021
kodiakhq bot pushed a commit that referenced this issue Jun 18, 2021
Updates the hotUpdateChunk to include `[runtime]` for web workers support.

Fixes #26152
Fixes #19865
Fixes #26144

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
flybayer pushed a commit to blitz-js/next.js that referenced this issue Jun 24, 2021
Updates the hotUpdateChunk to include `[runtime]` for web workers support.

Fixes vercel#26152
Fixes vercel#19865
Fixes vercel#26144

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants