Skip to content

Causes JavaScriptError in AWS CDK api-gateway #3742

@cn-cit

Description

@cn-cit

Describe the bug

When using the AWS CDK api gateway Model.EMPTY_MODEL (or ERROR_MODEL) the cdk stacks cannot synthesize or deploy.

Expected Behavior

The AWS CDK will not error when using the api gateway Model.EMPTY_MODEL

Current Behavior

@jsii/kernel.SerializationError: Of static property aws-cdk-lib.aws_apigateway.Model.EMPTY_MODEL: Unable to serialize value as aws-cdk-lib.aws_apigateway.IModel
🛑 Failing value is an instance of aws-cdk-lib.aws_apigateway.EmptyModel
EmptyModel { modelId: 'Empty' }
╰── 🔍 Failure reason(s):
╰─ Type 'aws-cdk-lib.aws_apigateway.EmptyModel' not found
at Object.process (/tmp/tmpdm_u1x99/lib/program.js:6194:19)

Reproduction Steps

use a Java cdk project and include this anywhere ...
Map<String, IModel> emptyResponseModels = new HashMap<>(); emptyResponseModels.put("application/json", Model.EMPTY_MODEL);
Use 1.67.0 of this library and the error occurs.

Possible Solution

No response

Additional Information/Context

revert back to 1.66.0 to overcome the problem.

SDK version used

AWS CDK 2.37.1

Environment details (OS name and version, etc.)

Windows 10

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.module/kernelIssues affecting the `jsii-kernel` modulep1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions