Skip to content

NodejsFunction: Inconsistent SDK behavior with and without runtime specification #26459

@rupe120

Description

@rupe120

Describe the bug

The bundled SDK is different when a runtime is specified, as opposed to when it is left as default.

Expected Behavior

The behavior of the SDK when using the default runtime value is the expected behavior.

Current Behavior

If you try to use newer methods, like the QuickSight asset export methods an error saying that the classes are not constructors.

The following is what is produced when specifying runtime: lambda.Runtime.NODEJS_18_X

{
  "errorType": "TypeError",
  "errorMessage": "import_client_quicksight.StartAssetBundleExportJobCommand is not a constructor",
  "trace": [
    "TypeError: import_client_quicksight.StartAssetBundleExportJobCommand is not a constructor",
    "    at startQuicksightAssetExport (/var/task/index.js:47:30)",
    "    at Runtime.handler (/var/task/index.js:71:40)",
    "    at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1083:29)"
  ]
}

The following is what the same line produces without specifying a runtime value

{
  "errorType": "ValidationException",
  "errorMessage": "1 validation error detected: Value '[]' at 'resourceArns' failed to satisfy constraint: Member must have length greater than or equal to 1",
  "trace": [
    "ValidationException: 1 validation error detected: Value '[]' at 'resourceArns' failed to satisfy constraint: Member must have length greater than or equal to 1",
    "    at throwDefaultError (/var/task/index.js:9134:24)",
    "    at /var/task/index.js:9144:39",
    "    at de_StartAssetBundleExportJobCommandError (/var/task/index.js:30731:18)",
    "    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
    "    at async /var/task/index.js:6077:24",
    "    at async /var/task/index.js:3722:22",
    "    at async /var/task/index.js:7329:42",
    "    at async /var/task/index.js:1186:26",
    "    at async startQuicksightAssetExport (/var/task/index.js:48531:41)",
    "    at async Runtime.handler (/var/task/index.js:48554:34)"
  ]
}

Each of these produce a Lambda using the NodeJs 18 runtime.

Reproduction Steps

Deploy the following repo into an account and run the quicksight-start-asset-export-w-runtime and quicksight-start-asset-export Lambdas.

https://github.com/rupe120/cdk-typescript-quicksight-sdk-test

Possible Solution

Unknown

Additional Information/Context

No response

CDK CLI Version

2.88.0

Framework Version

No response

Node.js Version

v18.16.1

OS

Windows 11 Enterprise build 22621.1702

Language

Typescript

Language Version

Typescript 5.1.6

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions