question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebpackDevMiddleware and Nodejs version compatibility

See original GitHub issue

Describe the bug

Serving static files and HMR using WebpackDevMiddleware results in 400 Bad request error using Node.js LTS 10.14.2.

Using Node.js LTS 8.12.0 works fine though.

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of ASP.NET Core 2.1 or 2.2 and Node.js LTS version 10.14.2 or higher
  2. Run this code https://github.com/jdebarochez/dotnet-webpack-hotreload-issue
  3. With dotnet run
  4. No files are served on the network

Expected behavior

  • Files in wwwroot folder should be served, even with WebpackDevMiddleware enabled
  • Updating frontend files should trigger hot module replacement in the browser.

Screenshots

Chrome network tab screenshot

Additional context

Here is the output in the console:

info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.1 GET https://localhost:44350/dist/main.js
trce: Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware[0]
      All hosts are allowed.
dbug: Microsoft.AspNetCore.Server.Kestrel[9]
      Connection id "0HLJ3B2FEC0E1" completed keep alive response.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 12.8842ms 400

Commenting UseWebpackDevMiddleware in Startup.cs serve correctly our static files, but does not grant access to HotModuleReplacement.

Downgrading Node.js to version 8.12.0 solved our issue. Is there anyway to troubleshoot/debug/trace the Nodejs instance created by WebpackDevMiddleware class?

We found it by luck. We didn’t find anything anywhere documenting such issue. Our SPA was rendering fine for some of our teammates and not for everyone. I’m still doubting Nodejs to be the only reason of our bug here.

Output of dotnet --info:

.NET Core SDK (reflecting any global.json):
 Version:   2.2.100
 Commit:    b9f2fa0ca8

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17134
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.2.100\

Host (useful for support):
  Version: 2.2.0
  Commit:  1249f08fed

.NET Core SDKs installed:
  1.1.0 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.402 [C:\Program Files\dotnet\sdk]
  2.1.403 [C:\Program Files\dotnet\sdk]
  2.2.100 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
k-vekoscommented, Jan 25, 2019

Having similar issues but with Microsoft.AspNetCore.SpaServices.AngularCli, when I try to view my app in a browser no response goes out and the browser request times out. Then one time I was able to see this error message:

20 14:35:05.107 Microsoft.AspNetC E: An unhandled exception has occurred while executing the request. System.Net.Http.HttpRequestException: Failed to proxy the request to http://localhost:60846/, because the request to the proxy target failed. Check that the proxy target server is running and accepting requests to http://localhost:60846/.

I have Node v10.15.0.

0reactions
mkArtakMSFTcommented, Aug 6, 2019

Thanks for contacting us. We’re closing this issue as this doesn’t align with our long-term plans in this area. You can read more details about our vision for this area at https://github.com/aspnet/AspNetCore/issues/12890.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Releases · webpack/webpack-dev-middleware
Contribute to webpack/webpack-dev-middleware development by creating an account on ... webpack version is 5.0.0; minimum supported Nodejs version is 14.15.0.
Read more >
webpack-dev-middleware
A development middleware for webpack. Latest version: 6.1.1, last published: 3 months ago. Start using webpack-dev-middleware in your ...
Read more >
webpack-dev-middleware versions and peer dependencies
Online Peer dependency version tool to search for compatible versions of related NPM packages.
Read more >
types/webpack-dev-middleware
Fast, reliable, and secure dependency management.
Read more >
To v5 from v4
Webpack 5 requires at least Node.js 10.13.0 (LTS), so make sure you upgrade your Node.js if you're still running an older one. Upgrade...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found