App stopped working, but it is online

my app suddenly stopped working in Chrome. If I take a look into my error console, I can see a lot of red errors like this:

WebSocket connection to 'wss://' failed: WebSocket is closed before the connection is established.
fbe08d7….js?meteor_js_resource=true:99 POST 404 ()
y._start @ fbe08d7….js?meteor_js_resource=true:99
(anonymous) @ fbe08d7….js?meteor_js_resource=true:99
fbe08d7….js?meteor_js_resource=true:99 Uncaught Error: INVALID_STATE_ERR
    at C._didClose (fbe08d7….js?meteor_js_resource=true:99)
    at fbe08d7….js?meteor_js_resource=true:99
    at n.XHRCorsObject.o.onfinish (fbe08d7….js?meteor_js_resource=true:99)
    at n.XHRCorsObject.i.emit (fbe08d7….js?meteor_js_resource=true:99)
    at XMLHttpRequest.s.xhr.onreadystatechange (fbe08d7….js?meteor_js_resource=true:99)

I can access the app still via HTTPS. Also FireFox is working without any problems. PM2 logs are empty.

The app is running behind a NGINX proxy for about 1 year, we didn’t change anything there. I get a 404 on

cache-control:no-store, no-cache, no-transform, must-revalidate, max-age=0
content-type:text/plain; charset=UTF-8
date:Tue, 14 Feb 2017 19:03:07 GMT

Just closed all Chrome instances and voila, it works again :joy:. But I saw on Kadira that certain users have the same problem, so I guess it must be something else. I’ve just opened 6 tabs to see if this caused the problem, but everything is working fine.

Finally solved it. This error occurs when WebSockets aren’t available or not working and you didn’t configure multiple instances without sticky session support. I’ve checked it manually with Firefox and disabled WebSockets and got those errors on every requeat. After enabling sticky session, everything worked fine, even without WebSockets.

Using pm2-meteor to deploy Meteor apps will cause this behavior, because it doesn’t support sticky sessions.

1 Like