Describe the bug
After marged #26271, Asserstions lambda function throw error at initialize phase and not working. This reason of problem is maybe to import aws-cdk-lib/custom-resources to use aws-sdk v2-v3 translate features.
aws-cdk-lib/custom-resources exports the some constructs, so when import the package, then bundle size is too large and lambda function is not working.
INIT_START Runtime Version: nodejs:18.v8 Runtime Version ARN: arn:aws:lambda:us-east-1::runtime:2755dc322c8dbb64760145d6403d14432af527bf4dd3cf03713aae10e0f8b552
--
2023-07-13T05:49:25.501Z undefined ERROR Uncaught Exception { "errorType": "TypeError", "errorMessage": "Class extends value undefined is not a constructor or null", "stack": [ "TypeError: Class extends value undefined is not a constructor or null", " at ../../aws-cdk-lib/core/lib/cfn-condition.ts (/var/task/index.js:796282:5)", " at __init (/var/task/index.js:9:56)", " at ../../aws-cdk-lib/core/lib/private/metadata-resource.ts (/var/task/index.js:807561:5)", " at __init (/var/task/index.js:9:56)", " at ../../aws-cdk-lib/core/lib/private/synthesis.ts (/var/task/index.js:814938:5)", " at __init (/var/task/index.js:9:56)", " at ../../aws-cdk-lib/core/lib/app.ts (/var/task/index.js:814966:5)", " at __init (/var/task/index.js:9:56)", " at ../../aws-cdk-lib/core/lib/stack.ts (/var/task/index.js:816570:5)", " at __init (/var/task/index.js:9:56)" ] }
2023-07-13T05:49:38.254Z undefined ERROR Uncaught Exception { "errorType": "TypeError", "errorMessage": "Class extends value undefined is not a constructor or null", "stack": [ "TypeError: Class extends value undefined is not a constructor or null", " at ../../aws-cdk-lib/core/lib/cfn-condition.ts (/var/task/index.js:796282:5)", " at __init (/var/task/index.js:9:56)", " at ../../aws-cdk-lib/core/lib/private/metadata-resource.ts (/var/task/index.js:807561:5)", " at __init (/var/task/index.js:9:56)", " at ../../aws-cdk-lib/core/lib/private/synthesis.ts (/var/task/index.js:814938:5)", " at __init (/var/task/index.js:9:56)", " at ../../aws-cdk-lib/core/lib/app.ts (/var/task/index.js:814966:5)", " at __init (/var/task/index.js:9:56)", " at ../../aws-cdk-lib/core/lib/stack.ts (/var/task/index.js:816570:5)", " at __init (/var/task/index.js:9:56)" ] }
START RequestId: b6da27f5-d7ff-4f76-807b-c7f5d1f02d1f Version: $LATEST
Unknown application error occurredRuntime.Unknown
END RequestId: b6da27f5-d7ff-4f76-807b-c7f5d1f02d1f
REPORT RequestId: b6da27f5-d7ff-4f76-807b-c7f5d1f02d1f Duration: 13083.91 ms Billed Duration: 13084 ms Memory Size: 128 MB Max Memory Used: 128 MB
Expected Behavior
Assertions function is working.
Current Behavior
Assertions function is not working.
- handler size 26 MB is too large
- runtime memory used 128 MB / 128 MB
- error message is "Unknown application error occurredRuntime.Unknown"
Reproduction Steps
- Clone latest aws-cdk git repository
- yarn
- yarn build --skip-test
- cd packages/@aws-cdk-testing/framework-integ
- yarn integ --force test/aws-apigateway/test/integ.lambda-api.js
Possible Solution
Don't import aws-cdk-lib/custom-resources. Instead, consider the following pattern.
Additional Information/Context
bundle size
$ cd packages/@aws-cdk/integ-tests-alpha
$ yarn bundle
yarn run v1.22.19
$ esbuild --bundle lib/assertions/providers/lambda-handler/index.ts --target=node14 --platform=node --outfile=lib/assertions/providers/lambda-handler.bundle/index.js
<Skip build messages>
lib/assertions/providers/lambda-handler.bundle/index.js 25.8mb ⚠️
Done in 0.62s.
CDK CLI Version
2.88.0 (not release yet)
Framework Version
2.88.0 (not release yet)
Node.js Version
v18.15.0
OS
Amazon Linux 2
Language
Typescript
Language Version
TypeScript (5.1.3)
Other information
No response
Describe the bug
After marged #26271, Asserstions lambda function throw error at initialize phase and not working. This reason of problem is maybe to import
aws-cdk-lib/custom-resourcesto use aws-sdk v2-v3 translate features.aws-cdk-lib/custom-resourcesexports the some constructs, so when import the package, then bundle size is too large and lambda function is not working.Expected Behavior
Assertions function is working.
Current Behavior
Assertions function is not working.
Reproduction Steps
Possible Solution
Don't import
aws-cdk-lib/custom-resources. Instead, consider the following pattern.Additional Information/Context
bundle size
CDK CLI Version
2.88.0 (not release yet)
Framework Version
2.88.0 (not release yet)
Node.js Version
v18.15.0
OS
Amazon Linux 2
Language
Typescript
Language Version
TypeScript (5.1.3)
Other information
No response