Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Node server keeps crashing repeatedly with "Error: reserved fields must be empty" #94

Closed
booboothefool opened this issue Mar 9, 2017 · 6 comments

Comments

@booboothefool
Copy link

booboothefool commented Mar 9, 2017

This started happening suddenly, and now I can't even get my server back up. It's been a few hours. It just restarts, then immediately crashes. Using 0.5.1 btw.

Any ideas?

screen shot 2017-03-09 at 6 52 02 pm

Very scary...
screen shot 2017-03-09 at 8 26 49 pm

@booboothefool
Copy link
Author

booboothefool commented Mar 10, 2017

Where do I add this:

websockets/ws#1039 (comment)

For this library?

new SubscriptionServer(
  {
    subscriptionManager,
    keepAlive: 20000,
    onConnect: async (connectionParams, webSocket) => {
        webSocket.on('error', err => console.error(err));
    },
  },
  {
    server: websocketServer,
    path: '/',
  }
);

wasn't it. Doesn't stop the crashing.

Also

onConnect?: (connectionParams: Object, webSocket: WebSocket) : optional method that called when a client connects to the socket, called with the connectionParams from the client, if the return value is an object, its elements will be added to the context. return false or throw an exception to reject the connection. May return a Promise.

Should I be throwing an exception?

@booboothefool
Copy link
Author

booboothefool commented Mar 10, 2017

I'm trying to add the line here now: https://github.com/apollographql/subscriptions-transport-ws/blob/master/src/server.ts#L96

But installing my fork from GitHub doesn't install the /src directory... huh?

UPDATE: Alright so I literally just made the change, compiled the ts, and committed the entire folder for now. Server has been crashing like this for over a day now, so I just needed it in. Will let you know how it goes / if it catches the same error.

@booboothefool
Copy link
Author

booboothefool commented Mar 10, 2017

Alright, so after committing the entire folder to make sure the change was in lol..., which btw was adding:

https://github.com/apollographql/subscriptions-transport-ws/blob/master/src/server.ts#L96

            request.on('error', function (err) {
                console.error(err);
            });

the error is being caught, and my server stopped crashing. After about 10 or so 1 star reviews on my app within the past day, hahaha. 👍

I'm just happy the server doesn't crash, however would like to understand why this is happening if anyone knows. Thanks.

@Urigo
Copy link
Contributor

Urigo commented Mar 12, 2017

@booboothefool that is a good idea.
Also looks like a pretty simple change, would you like to create a PR to expose that event on the subscriptionServer?

@Urigo
Copy link
Contributor

Urigo commented May 19, 2017

Fixed in #130

@dotansimha
Copy link
Contributor

Thank you for opening this issue, @booboothefool . we fixed it in 0.7.0,
and now we are handling the error callback of the socket,
as you suggested.
(#130)

martijnwalraven pushed a commit that referenced this issue Oct 17, 2017
fix: grammatical error in subscriptions docs
baconz pushed a commit to PhiloInc/subscriptions-transport-ws that referenced this issue Apr 24, 2018
* 0.2.5

* update changelog

* update CHANGELOG.md - fix old typo
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants