Skip to content
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

WebSocket: Error 500 when using adapter for $connect route #49

Open
ceilfors opened this issue Jun 2, 2019 · 0 comments

Comments

@ceilfors
Copy link
Member

@ceilfors ceilfors commented Jun 2, 2019

Describe the bug
WebSocket adapter returns 500 without any error. I couldn't find what is causing the error as the error message is swallowed for $connect route.

To Reproduce

serverless.yml

  manage-connection:
    handler: src/manage-connection.handler
    events:
      - websocket:
          route: $connect

handler code:

const laconia = require("@laconia/core");
const adapterApi = require("@laconia/adapter-api");

const app = async () => {};
const webSocket = adapterApi.webSocket();

exports.handler = laconia(webSocket(app));

Expected behavior

  1. Return 200 as $connect is a happy path
  2. Error message should be surfaced to the user

Actual behavior

  1. Return 500
  2. Error message is swallowed, I needed to go to createWebSocketAdapter.js and put a console.log inside catch block

The error message:

2019-06-02T19:48:59.072Z	296c7fe1-bf76-44bb-a958-79f9351af52e	TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
at Function.Buffer.from (buffer.js:183:11)
at module.exports.event (/var/task/node_modules/@laconia/adapter-api/node_modules/@laconia/event/src/apigateway/getBody.js:2:10)
at module.exports.event (/var/task/node_modules/@laconia/adapter-api/node_modules/@laconia/event/src/apigateway/parseWebSocket.js:5:16)
at fromRaw (/var/task/node_modules/@laconia/adapter-api/node_modules/@laconia/event/src/apigateway/ApiGatewayWebSocketEvent.js:10:7)
at /var/task/node_modules/@laconia/adapter-api/src/createWebSocketAdapter.js:5:30
at laconia (/var/task/node_modules/@laconia/core/src/laconia.js:30:28)
at <anonymous>
ceilfors added a commit that referenced this issue Jun 6, 2019
Error message is currently silently swallowed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.