cdk-constructs icon indicating copy to clipboard operation
cdk-constructs copied to clipboard

Error: Cannot find module 'aws-sdk' in version 2.2.0.

Open kadishmal opened this issue 1 year ago • 1 comments

We have pushed a breaking change that throws the following error during deployment.

Received response status [FAILED] from custom resource. Message returned: Error: Cannot
find module 'aws-sdk'
Require stack:
- /var/task/index.js
- /var/task/__entrypoint__.js
- /var/runtime/index.mjs

The reason is that we have upgraded Node runtime in Lambda to v18, which drops AWS SDK v2 as a runtime dependency and instead includes v3.

Blast radius

Anybody who wants to upgrade to v2.2.0 will have their stack deployments rollback due to the above error. The existing deployment will not be affected.

Solutions

To mitigate the issue we have to either:

  1. Downgrade Node runtime to v16 from v18.
  2. Move aws-sdk to production dependencies section so that Lambda code includes the library, and remove from externals. ✅

The longterm solution is to migrated AWS SDK to v3. We will publish an intermediary release to mitigate the issue, then will push a longterm solution.

kadishmal avatar Apr 02 '24 06:04 kadishmal

Mitigated the issue by including the AWS SDK v2 into each Lambda bundle. Soon will migrate AWS SDK v3.

kadishmal avatar May 14 '24 06:05 kadishmal