Skip to content

integ-tests-alpha: assertions provider function is not working  #26359

@WinterYukky

Description

@WinterYukky

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

  1. Clone latest aws-cdk git repository
  2. yarn
  3. yarn build --skip-test
  4. cd packages/@aws-cdk-testing/framework-integ
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/assertionsRelated to the @aws-cdk/assertv2 packagebugThis issue is a bug.effort/mediumMedium work item – several days of effortp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions