payload: {"action":"created","issue":{"url":"https://api.github.com/repos/SignalK/signalk-server-node/issues/751","repository_url":"https://api.github.com/repos/SignalK/signalk-server-node","labels_url":"https://api.github.com/repos/SignalK/signalk-server-node/issues/751/labels{/name}","comments_url":"https://api.github.com/repos/SignalK/signalk-server-node/issues/751/comments","events_url":"https://api.github.com/repos/SignalK/signalk-server-node/issues/751/events","html_url":"https://github.com/SignalK/signalk-server-node/issues/751","id":421968686,"node_id":"MDU6SXNzdWU0MjE5Njg2ODY=","number":751,"title":"Server crash when providing an invalid JWT token to websocket endpoint","user":{"login":"mairas","id":407010,"node_id":"MDQ6VXNlcjQwNzAxMA==","avatar_url":"https://avatars1.githubusercontent.com/u/407010?v=4","gravatar_id":"","url":"https://api.github.com/users/mairas","html_url":"https://github.com/mairas","followers_url":"https://api.github.com/users/mairas/followers","following_url":"https://api.github.com/users/mairas/following{/other_user}","gists_url":"https://api.github.com/users/mairas/gists{/gist_id}","starred_url":"https://api.github.com/users/mairas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mairas/subscriptions","organizations_url":"https://api.github.com/users/mairas/orgs","repos_url":"https://api.github.com/users/mairas/repos","events_url":"https://api.github.com/users/mairas/events{/privacy}","received_events_url":"https://api.github.com/users/mairas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-03-17T20:27:36Z","updated_at":"2019-03-18T17:19:16Z","closed_at":null,"author_association":"NONE","body":"When beginning to implement token authentication in [SensESP](https://github.com/mairas/SensESP), I ran into the following:\r\n\r\nIf I feed an invalid JWT token to the websocket endpoint, the server crashes. A sample request, captured with `tcpdump` on the server:\r\n\r\n```\r\nGET /signalk/v1/stream?subscribe=none HTTP/1.1\r\nHost: 192.168.9.134:80\r\nConnection: Upgrade\r\nUpgrade: websocket\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Key: 3D/tJftsWmmVONQ8lhVMgg==\r\nSec-WebSocket-Protocol: arduino\r\nOrigin: file://\r\nUser-Agent: arduino-WebSocket-Client\r\nAuthorization: JWT 123456\r\n\r\n```\r\n\r\nand the result on the server log:\r\n\r\n```\r\nMar 17 18:07:25 hurma signalk-server[31856]: signalk-server running at 0.0.0.0:[object Object]\r\nMar 17 18:07:26 hurma signalk-server[31856]: events.js:174\r\nMar 17 18:07:26 hurma signalk-server[31856]:       throw er; // Unhandled 'error' event\r\nMar 17 18:07:26 hurma signalk-server[31856]:       ^\r\nMar 17 18:07:26 hurma signalk-server[31856]: Error: read ECONNRESET\r\nMar 17 18:07:26 hurma signalk-server[31856]:     at TCP.onStreamRead (internal/stream_base_commons.js:111:27)\r\nMar 17 18:07:26 hurma signalk-server[31856]: Emitted 'error' event at:\r\nMar 17 18:07:26 hurma signalk-server[31856]:     at emitErrorNT (internal/streams/destroy.js:82:8)\r\nMar 17 18:07:26 hurma signalk-server[31856]:     at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)\r\nMar 17 18:07:26 hurma signalk-server[31856]:     at process._tickCallback (internal/process/next_tick.js:63:19)\r\nMar 17 18:07:26 hurma systemd[1]: signalk-server.service: Main process exited, code=exited, status=1/FAILURE\r\n```\r\n\r\nI would have expected to receive an HTTP 401 error instead."},"comment":{"url":"https://api.github.com/repos/SignalK/signalk-server-node/issues/comments/474016088","html_url":"https://github.com/SignalK/signalk-server-node/issues/751#issuecomment-474016088","issue_url":"https://api.github.com/repos/SignalK/signalk-server-node/issues/751","id":474016088,"node_id":"MDEyOklzc3VlQ29tbWVudDQ3NDAxNjA4OA==","user":{"login":"mairas","id":407010,"node_id":"MDQ6VXNlcjQwNzAxMA==","avatar_url":"https://avatars1.githubusercontent.com/u/407010?v=4","gravatar_id":"","url":"https://api.github.com/users/mairas","html_url":"https://github.com/mairas","followers_url":"https://api.github.com/users/mairas/followers","following_url":"https://api.github.com/users/mairas/following{/other_user}","gists_url":"https://api.github.com/users/mairas/gists{/gist_id}","starred_url":"https://api.github.com/users/mairas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mairas/subscriptions","organizations_url":"https://api.github.com/users/mairas/orgs","repos_url":"https://api.github.com/users/mairas/repos","events_url":"https://api.github.com/users/mairas/events{/privacy}","received_events_url":"https://api.github.com/users/mairas/received_events","type":"User","site_admin":false},"created_at":"2019-03-18T17:19:16Z","updated_at":"2019-03-18T17:19:16Z","author_association":"NONE","body":"Yes, it happens consistently. I don't think the client is resetting by itself, though, because at that point adding the Authorization header was the only change I made to previously working code."}}
other: {"actor":{"display_login":"mairas"}}