Webpack-dev-server: [3.0.0-alpha6] Connection reset crash when manually refreshing page

Created on 25 Dec 2017  路  9Comments  路  Source: webpack/webpack-dev-server

Please note that this template is not optional. If you proceed with this form,
please fill out _all_ fields, or your issue may be closed as "invalid."
Please do not delete this template. Please ask questions on StackOverflow or the
webpack Gitter (https://gitter.im/webpack/webpack). _General questions, how-to
questions, and support requests will be closed._
Please do remove this header to acknowledge this message.

  • Operating System: macOS Sierra 10.12.6
  • Node Version: v8.1.4
  • NPM Version: 5.5.1
  • webpack Version: 3.10.0
  • webpack-dev-server Version: 3.0.0-alpha6
  • [x] This is a bug
  • [ ] This is a feature request
  • [ ] This is a modification request

Code

const compiler = webpack(config)
const server = new WebpackDevServer(compiler, {
  historyApiFallback: {
    index: config.output.publicPath,
    disableDotRule: true
  },
  publicPath: config.output.publicPath,
  https: {
    key: fs.readFileSync(path.join(__dirname, '../certs/local.key')),
    cert: fs.readFileSync(path.join(__dirname, '../certs/local.crt'))
  },
  hot: true,
  host: routes.frontend.hostname,
  headers: { 'Access-Control-Allow-Origin': '*' },
  port: routes.frontend.port
})

server.listen(error => {
  if (error) {
    console.log(error)
  }
})

Expected Behavior

The page refreshes and loads the content.

Actual Behavior

Upon refreshing the page, the dev server crashes with the following error:

events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at exports._errnoException (util.js:1022:11)
    at TLSWrap.onread (net.js:610:25)

HMR works as expected. This issue seems to be limited to manual refreshes and chunks that are not hot reloaded.

For Bugs; How can we reproduce the behavior?

This can be reproduced on the 3.0.0-alpha6 release with any configuration.

For Features; What is the motivation and/or use-case for the feature?

Cheers 馃嵒

Most helpful comment

I have no affiliation with the wds team so cant greenlight any PRs :)

I created a fork with this fix included, you can use it package.json like this:

"devDependencies": {
 "webpack-dev-server": "dev357/webpack-dev-server#next"
}

All 9 comments

I'm getting this pretty consistently on 3.0.0-alpha5 _without_ a manual refresh.
Just a rebuild being triggered via file watching. Unable to find an explicit action that's causing it to crash.

edit: but it does happen _after_ webpack compiles successfully and chrome reloads the page. Haven't been able to reproduce in firefox yet.

Seems to be an unhandled error(ECONNRESET) in the websocket connection in DevServer.js

You can add this on line 128 to fix it for now:

ws.on("error", err => {
  log.error(err);
});

@dev357 the above solution "on error", is theres any reason not to introd a temporary fix for the next release?, I find it a bit troublesome to update DevServer.js after each "npm install" i do in-between branch switching

To reiterate: would you greenlight a PR for it ?

I have no affiliation with the wds team so cant greenlight any PRs :)

I created a fork with this fix included, you can use it package.json like this:

"devDependencies": {
 "webpack-dev-server": "dev357/webpack-dev-server#next"
}

Yes, an 'error' listener should always be added.
Ref: https://github.com/websockets/ws/issues/1256

All, @next is no longer being worked on. The team has decided in a change of direction. More info to follow, but you should consider the alpha versions of 3.0.0 unsupported.

@shellscape thanks for the update, where's a good spot we could follow updates (re: more info to follow)

Any update available as to the plans for this project? Will there be some other branch? Another project altogether?

Thanks for all your hard work, WDS team :)

@akatechis: Please see v3.0.0-beta.1.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ky6uk picture Ky6uk  路  3Comments

eyakcn picture eyakcn  路  3Comments

daryn-k picture daryn-k  路  3Comments

gimmi picture gimmi  路  3Comments

uMaxmaxmaximus picture uMaxmaxmaximus  路  3Comments