Servless Web Socket Plugin - Problem Deploying

Hello all!

I am trying to deploy my new websocket api gateway. Following the documentation here, I have created a little hello world app.

However, when I try to deploy, I get the following error:

Serverless Error ---------------------------------------
You need to set the “route” when using the websocket event.

If I change my functions to use the “route” param instead of “routeKey”, then I get this error:

Serverless Error ---------------------------------------

Missing required key ‘RouteKey’ in params

if I try a combination of the two, I can get deploy successfully, but the websocket does not register any connection attempt.

Has anyone seen this before?

Here is my serverless yaml for reference:

functions:
    connectionManagement:
        handler: connectionHandler.connectionHandler
        events:
            - websocket:
                  routeKey: $connect
            - websocket:
                  routeKey: $disconnect
    defaultMessage:
        handler: connectionHandler.defaultHandler
        events:
            - websocket:
                  routeKey: $default
    chatMessage:
        handler: messageHandler.sendMessage
        events:
            - websocket:
                  routeKey: message

Hi, serverless natively supports websockets, you don’t need to use any plugins right now. Please take a look if you have a serverless-websockets-plugin remove it and use route instead of routeKey (plugin uses a routeKey param). Serverless version should be at least 1.38.0.

p.s. if it doesn’t help - please provide the whole serverless.yml

2 Likes