Skip to content
← Back to activity

Public problem

apigateway: Unable to serialize value as aws-cdk-lib.aws_apigateway.IModel with Model.EMPTY_MODEL

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Using the CDK in Python with awsapigateway, referencing agw.Model.EMPTYMODEL in method responses started failing with jsii.errors.JavaScriptError: Unable to serialize value as aws-cdk-lib.awsapigateway.IModel. It affected CDK users in every language except TypeScript/JavaScript, on framework versions 2.41.0 through 2.43.0. The cause was that EMPTYMODEL returned an instance of a deprecated class that jsii could not serialize across languages.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

This was a framework bug in aws-cdk-lib 2.41.0 to 2.43.0, fixed upstream, so upgrade to a version newer than 2.43.0. The issue only hit non-TypeScript languages using Model.EMPTYMODEL (or other values returning deprecated class instances). After upgrading, the same MethodResponse code with responsemodels={'application/json': agw.Model.EMPTY_MODEL} synthesizes normally again. Source: https://github.com/aws/aws-cdk/issues/21902