From 7842ca1d8b7d2fd48716b3fb9661590a094885d8 Mon Sep 17 00:00:00 2001 From: Ryan Block Date: Thu, 1 Feb 2024 10:28:56 -0800 Subject: [PATCH] Update `@ws` `RouteSelectionExpression` that did not match Sandbox --- changelog.md | 8 ++++++++ src/visitors/ws/index.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 790145b..c3e3c48 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,14 @@ - Added Node.js 20.x to test matrix - Breaking change: removed support for Node.js 14.x (now EOL, and no longer available to created in AWS Lambda) + +### Fixed + +- Potentially breaking fix: resolved mismatch between `RouteSelectionExpression` in deployed Architect apps vs. locally in Sandbox + - The `RouteSelectionExpression` is now `$request.body.action`, meaning WebSocket code running locally (but not on AWS) should be updated from `ws.send(JSON.stringify({ message: 'custom-endpoint', ... }))` to `ws.send(JSON.stringify({ action: 'custom-endpoint', ... }))` + - This fixes #768; thanks @mawdesley + @MartinRamm! + + --- ## [8.5.2] 2023-08-22 diff --git a/src/visitors/ws/index.js b/src/visitors/ws/index.js index 062d6fa..ad06a92 100644 --- a/src/visitors/ws/index.js +++ b/src/visitors/ws/index.js @@ -16,7 +16,7 @@ module.exports = function visitWebSockets (inventory, template) { Properties: { Name, ProtocolType: 'WEBSOCKET', - RouteSelectionExpression: '$request.body.message' + RouteSelectionExpression: '$request.body.action' } }