Description
Describe the bug
In this readme section, https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-lambda-nodejs/README.md#externals, it states that
When passing a runtime that is known to include a version of the aws sdk, it will be excluded by default. For example, when passing NODEJS_16_X, aws-sdk is excluded. When passing NODEJS_18_X, all @aws-sdk/* packages are excluded.
However, the core runtime of the AWS SDK for JavaScript (v3) is contained in the scope @smithy/*
as can be seen in e.g. client-s3/package.json. If a user application has a certain version of the AWS SDK with both core runtime @smithy/
and AWS packages under @aws-sdk/
, deleting only the @aws-sdk/
packages can create a fatal version mismatch between the two sets of dependencies.
From the AWS SDK team's perspective, we recommend that the SDK is not removed from user applications due to the AWS Lambda provided SDK having an unpredictable version update cadence. A sudden change in version not initiated by the user may cause errors due to changes in behavior even if technically no "breaking" interface changes occur.
However, if continuing to remove the @aws-sdk
node_modules folder, the @smithy
folder should be treated identically since they are tightly coupled.
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Version
No response
Expected Behavior
If deleting @aws-sdk/
folder, also delete @smithy/
folder. Both NPM scopes are fully controlled by AWS teams.
Current Behavior
Only @aws-sdk/
is deleted, causing mismatch between those and the @smithy/
packages.
Reproduction Steps
Use NODEJS_18_X
runtime and bundle the @aws-sdk/client-s3
package as an example.
Inspect the node_modules folder for the existence of @smithy/
packages.
Possible Solution
If deleting @aws-sdk/
folder, also delete @smithy/
folder.
Additional Information/Context
No response
CDK CLI Version
n/a
Framework Version
No response
Node.js Version
NODEJS_18_X, possibly others except NODEJS_LATEST
OS
n/a
Language
TypeScript
Language Version
No response
Other information
No response