aspnet / JavaScriptServices

[Archived] This repository has been archived
Apache License 2.0
3.04k stars 519 forks source link

System.Net.Http.WinHttpException when using WebpackDevMiddleware and Node v8.1.0 #1024

Closed jsfeldman closed 7 years ago

jsfeldman commented 7 years ago

I upgraded my version of Node to v8.1.0 and I started getting System.Net.Http.WinHttpException error messages when navigating to my site when it was being served by WebpackDevMiddleware and I'm not authenticated. I'm using CookieAuthentication.

I know 8.1.0 is the latest version of Node and not what's recommended for most users so I apologize if JavaScriptServices is specifically targeted for that version of Node. I wasn't sure.

Here is the full text of the error message if it helps:

System.IO.IOException: The read operation failed, see inner exception. ---> System.Net.Http.WinHttpException: The server returned an invalid or unrecognized response
   --- End of inner exception stack trace ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.IO.Stream.<CopyToAsyncInternal>d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.SpaServices.Webpack.ConditionalProxyMiddleware.<PerformProxyRequest>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.SpaServices.Webpack.ConditionalProxyMiddleware.<Invoke>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1.<RequestProcessingAsync>d__2.MoveNext()

Let me know if there is anything else you need.

SteveSandersonMS commented 7 years ago

I tried to repro this issue, but could not. After upgrading to Node 8.1.0, I found that it continued to work fine.

I'm not sure what's specific to your application that breaks with Node 8.1.0. If you're able to track this down and still think there's some bug in the JavaScriptServices code, please let us know the details and we'll definitely fix it if possible.

Since this seems like something specific to your application, I'm going to have to close this as a "no repro". Hope that's OK. Please do let us know if you can either provide a simple repro (as in, what minimal edit steps we need to make to one of the templates in this repo to produce this error), or can identify a specific bug!

jsfeldman commented 7 years ago

Sorry, at the time I thought it would be easier to reproduce than it is because it's happening to all the projects I'm working on, but I tried recreating it using the sample template and this template: https://github.com/MarkPieszak/aspnetcore-Vue-starter and I wasn't seeing the error from it either.

We generated a template that we based our projects on here: https://github.com/ZPDreamTeam/ASPNET-VueJS-Webpack-BoilerPlate and I'm seeing the error when I run it. Hopefully, it is pared down enough to be easy to look through. It is essentially the vue-cli template stuffed into the dotnet new template with the WebpackDevMiddleware lines added.

The only unique feature to it I can think of is that the whole client, including the package.json, is in a subfolder so the ProjectPath and ConfigFile need to be changed, but besides that I can't think of any differences.

I apologize for not being able to narrow it down further. Will the above repo serve as a simple template? Let me know if it doesn't generate the error or is too complicated. I'm trying to create an example with most of the vue-cli template tossed out and the webpack sample from this repository put in, because I don't think the client section is the cause of the issue, but I'm getting errors and my webpack/typescript knowledge is a little flighty.

jsfeldman commented 7 years ago

My mistake, I think this is actually an issue with the hot reloading configuration and Node 8.1.0 and not the WebpackDevMiddleware. I saw a c# looking error and assumed it was that. Sorry for bothering you and thanks for your help.

Edit: Updating Node to 8.1.1 fixed the issue. Thanks.