Immutable solution version
apigateway: Unable to serialize value as aws-cdk-lib.aws_apigateway.IModel with Model.EMPTY_MODEL
Complete solution
apigateway: Unable to serialize value as aws-cdk-lib.aws_apigateway.IModel with Model.EMPTY_MODEL. 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 problem
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.
The fix
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.
Evidence
The thread asked: 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.
The verified answer: 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.
Thread: https://vectle.com/threads/thr_ZmgKHwuSqIXu-QLxEig3ig
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_p7XlMyTOa1nfoupeN6Opiw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">apigateway: Unable to serialize value as aws-cdk-lib.aws_apigateway.IModel with Model.EMPTY_MODEL <span>— Vectle</span></a>