-
Notifications
You must be signed in to change notification settings - Fork 296
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
Can't get a response from middleware #36
Comments
Which browser is this? If you try it in a recent version of chrome then you should see some information about the event stream messages. Does the logging in the server process or the client show any information or errors? |
Thanks for the reply @glenjamin , I've tried both with Chrome and Firefox.
No response is returned (Failed to load response data). On the server I told the middleware to log with console.log and I can see just those lines:
So it seems that the middleware is running but the client can't connect to it. Looking at the middlware code, if I try to add |
Can you use If not, can you post your full express server setup? It would appear that the middleware isn't getting loaded properly. |
Nope, request time out even with curl. Express setup has ben cloned from this boilerplate, so should be a pretty basic one. |
I've checked on Node If you haven't made any changes I'd recommend trying another sample project to see if there are any differences, like this one - https://github.com/glenjamin/ultimate-hot-reloading-example, or the If those work then the issue must be with the boilerplate, if not then I'm stumped. |
Tried both, same result. Guess it could be a problem with my machine, but I don't know where to look to find a solution or what may cause this strange behaviour. |
Is your browser connecting directly to the stream? Any kind of proxy in the way? We saw a similar issue with #10 |
Not that I'm aware of, also I don't think it's a browser problem since also curl request times out... |
Looking at the server of the
But with curl:
|
Weird, here's what it should look like, the cURL request stays open forever (until manually killed).
The log line on the server side doesn't appear until the incoming request has completed. It might be that 10 seconds is too short - the heartbeat is set to exactly 10 seconds by default. Try either making cURL wait a bit longer, or reducing the timeout setting on the server. |
Here it is, with 30 seconds timeout:
And the server:
|
That makes no sense! It's acting like something is buffering the response, but nothing should be. Can you try with a slightly older version of nodejs? Can you also include the full output of |
I can't try it now but I'll do this evening I think. How much older? 4.0 is On Sun, 11 Oct 2015 15:24 Glen Mailer [email protected] wrote:
|
I'd say try 4.0 and 0.12. |
Just a quick update: this morning I tried it on my computer at work, which also runs on Win 7 x64, and hmr runs with no problem, so it's not a general Windows problem... |
Same issue. |
If you're seeing the heartbeat in cURL and the reload event in the console, that's a slightly different issue. Can you report in a separate thread with details of your environment? |
Thanks for the reply @glenjamin, I'll write later |
@spirAde Did you solved your problem? I thought that specifying 3000 port in config's path parameter will be alike workaround, but such syntax is not supported :( |
Hello, I have the same issue. |
Can you post your webpack config? Does the curl example above work? |
@glenjamin My webpack config is the one from https://github.com/gaearon/react-transform-boilerplate , I just cloned the project and tried to run it.
|
YES, http://localhost:3000/__webpack_hmr will be pended for about some minutes. |
My problem was caused by http proxy. |
I have the same issue on Win10 x64 |
I also have same issue on Win10 x64 |
my config is the one from https://github.com/gaearon/react-transform-boilerplate. no nginx only webpack-dev-server. |
This definitely seems to affecting mainly windows, everyone who's managed to resolve this issue has identified some sort of MITM that's buffering or blocking responses. The steps to debug are:
If you can connect with cURL, there's something messing with the transport when being used in the browser If you can't connect with cURL, there's something messing with the server's data. |
I tried to curl the request but didn't get a response from the middleware. |
In my case when I removed the express compression middleware the event source started to receive messages again. |
And i am experiencing the issue as well. Windows 10, 64bit. Chrome v47. Similar to others, cloned the template too. Tried on node 4.1.1 and 5.4.1. I can confirm that curl'ing the url does result in the heartbeat. I do agree that something is most likely buffering the response. Connected/disconnected from VPN still results in the same issue. I don't have a proxy set up either. |
To add to my last comment, i did curl with -v... and the first couple of connects it attempted to do resulted in 'port 3000 failed: bad access', but it was trying different IP addresses on my machine. On the 4th attempt it resolved to my machine. It was as if it cycled through the different possible network bridges on my machine before finally resolving to one. Though I'm not sure if that is just curl, or if it shows a wider issue on how the request is attempting to get resolved. |
The solution in my case was to add "eventsource-polyfill" to the webpack entry points. |
To add to my last comment. It seems that Bitdefender is somehow buffering the server sent events and breaking HMR. Uninstalling Bitdefender or using the eventsource-polyfill is the solution if you have Bitdefender AV installed. |
@davidhouweling Awesome, I've verified it on my machine with Sophos installed and it works. Thank you. |
Removing the localhost binding did not work for me. |
Seeing this as well for our exceptionally large build |
Size of build is fairly unlikely to be the problem. The things to check are noted in #36 (comment) |
@glenjamin the problem is that the heartbeat response times out. It seems as though the browser isn't "beating" quickly enough to prevent the timeout, which seems to be a downstream effect of locking during the compilation phase. I don't know enough about the particulars of the event loop and its effect on the heartbeat during processing, but the two don't seem mutually exclusive. I'm not on windows, and there's no MITM running (unless IT installed something without my knowledge, certainly possible, but they don't seem to know anything about it either). |
@dclowd9901 ah, I see - that must be a pretty long compile time! The simplest fix is to change the timeout setting to be longer. |
Is there a flag that I can pass through webpack-dev-server to change that? One didn't immediately pop out at me as I was browsing the code (I did see something that looked like a debounce timeout) |
@dclowd9901 Try increasing That setting is how long the browser waits for a heartbeat before giving up. |
I have the same issue with Vagrant/nginx proxy. Try to use Websocket instead of EventSource and it work https://github.com/lytc/webpack-hmr |
I'm running a server in vmware and experienced the same problem when connect from the host machine.
it stopped working. 😱 . Still can't figured what went wrong though. |
I can get the
#
|
You need to make sure you're using the same compiler instance for both dev-middleware and hot-middleware. In the example above you create an extra one. |
There is a way to have more than one config on the same compiler instance, but I've not used it myself - if you look through the closed issues / pull reqs you might find a useful example. |
Thanks @glenjamin , I fixed the problem follow your instructions.
|
I am on a mac, using express, node 7.0.0, yarn, and here are my deps. I am able to recreate this issue. Server looks like
When curling it I only get one heartbeat, then
SOLVED Looks like the hmr was working fine, but the |
The problem for me turned out to be my antivirus - BitDefender Internet Security. |
Bitdefender antivirus was blocking requests to http://localhost:8080/__webpack_hmr for me as well, fixed it by turning of real-time protection shield. |
Hello, I've got this problem trying to use webpack-hot-middlware.
I started a new project from React transform boilerplate but I can't get hot reloading to work.
On the browser I see that the call to http://localhost:3000/__webpack_hmr is made but gets no response, it gets canceled after ~ 20-30 seconds, and then it keep retrying with the same result. The dev tools just shows an empty response.
I'm running node 4.1.2 on Windows 7 x64.
The text was updated successfully, but these errors were encountered: