Skip to content

Upgrade runtime to Node 22 and AWS SDK v3#2

Open
Valamorde wants to merge 1 commit into
refactor/phase-1-cdk-v2from
refactor/phase-2-node22-sdk-v3
Open

Upgrade runtime to Node 22 and AWS SDK v3#2
Valamorde wants to merge 1 commit into
refactor/phase-1-cdk-v2from
refactor/phase-2-node22-sdk-v3

Conversation

@Valamorde
Copy link
Copy Markdown
Owner

Summary

  • Upgrades all Lambda functions from NODEJS_12_X to NODEJS_22_X
  • Replaces aws-sdk v2 with the modular AWS SDK v3 (@aws-sdk/client-dynamodb, @aws-sdk/lib-dynamodb, @aws-sdk/client-apigatewaymanagementapi)
  • Migrates all DDB calls from .promise() chaining to client.send(new XxxCommand(...))
  • Migrates ApiGatewayManagementApi to ApiGatewayManagementApiClient + PostToConnectionCommand

Notes

No logic changes — this is a pure runtime and SDK upgrade. Each Lambda function retains its existing structure; only the AWS client instantiation and call patterns change.

Test plan

  • All Lambda functions deploy without errors
  • CloudWatch logs show no SDK-level errors on invocation
  • WebSocket and HTTP flows behave identically to Phase 1

Runtime: NODEJS_12_X → NODEJS_22_X across all 5 Lambda functions.

SDK swap (all handlers):
- DynamoDB: AWS.DynamoDB.DocumentClient → DynamoDBDocumentClient.from(new DynamoDBClient())
- All .promise() calls → ddb.send(new XxxCommand())
- ApiGateway: AWS.ApiGatewayManagementApi → ApiGatewayManagementApiClient
- Endpoint now requires https:// prefix (SDK v3 requirement)
- Stale connection check: e.statusCode 410 → e.$metadata.httpStatusCode / e.name GoneException

Folded in zero-risk fixes while touching every line:
- onconnect: fix objectid/objectId implicit global (ReferenceError in strict mode)
- abovevttServices: remove dead getAllData() (referenced this.documentClient, never called)
- abovevttServices/sendmessage: remove dead require('http') and PRIORITY_ABOVE_NORMAL imports
- abovevttServices/migrate: fix for(tokenid) → for(const tokenid), batch slice(i,i+21) → slice(i,i+25)
- All handlers: replace hardcoded "abovevtt" table name with process.env.TABLE_NAME
- sendmessage: extract makeApigw() helper, remove unused apigwManagementApi in delete_scene/update_scene

cdk synth verified: all 5 runtimes nodejs22.x, table logical ID and DeletionPolicy unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant