From ceda78b960755d2e9fe1ebd6d323822eb4c970a6 Mon Sep 17 00:00:00 2001 From: Christian Nuss Date: Fri, 26 Nov 2021 15:56:19 -0800 Subject: [PATCH] fix: prevent client responses on $disconnect --- src/events/websocket/WebSocketClients.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/events/websocket/WebSocketClients.js b/src/events/websocket/WebSocketClients.js index dd5da99e2..515fa75b9 100644 --- a/src/events/websocket/WebSocketClients.js +++ b/src/events/websocket/WebSocketClients.js @@ -167,6 +167,7 @@ export default class WebSocketClients { const { body } = await lambdaFunction.runHandler() if ( body && + routeKey !== '$disconnect' && route.definition.routeResponseSelectionExpression === '$default' ) { // https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-response-selection-expressions