Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

‼️ NOTICE | apigateway: Unable to serialize value as aws-cdk-lib.aws_apigateway.IModel #21902

Closed
jaspotter opened this issue Sep 2, 2022 · 46 comments · Fixed by #22204 · May be fixed by aws-samples/amazon-sagemaker-automatic-deploy-mlflow-model#6
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. management/tracking Issues that track a subject or multiple issues p0

Comments

@jaspotter
Copy link

jaspotter commented Sep 2, 2022

Please add your +1 👍 to let us know you have encountered this

Status: RESOLVED

Overview:

Users of CDK in any language other than TS/JS cannot use values that return an instance of a deprecated class.

Affected Versions

Any version greater or equal to 2.41.0

Complete Error Message:

144 | jsii.errors.JavaScriptError:
145 | **@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**
146 | ├── 🛑 Failing value is an instance of aws-cdk-lib.aws_apigateway.EmptyModel
147 | │      EmptyModel { modelId: 'Empty' }
148 | ╰── 🔍 Failure reason(s):
149 | ╰─ Type 'aws-cdk-lib.aws_apigateway.EmptyModel' not found
150 | at Object.process (/tmp/tmpdm_u1x99/lib/program.js:6194:19)

Workaround:

Case by case workarounds, such as ones described here.

You could also pin the jsii client libraries to 1.68.0:

Python

jsii==1.68.0

Java

<dependency>
  <groupId>software.amazon.jsii</groupId>
  <artifactId>jsii-runtime</artifactId>
  <version>1.68.0</version>
</dependency>

Golang

require (
	github.com/aws/jsii-runtime-go v1.68.0
)

C#

Amazon.JSII.Runtime==1.68.0

Solution:

TBD

Related Issues:


Original report


Describe the bug

I have a CDK v2 project in python and the "cdk synth" command is now suddenly failing. Below is the error from CodeBuild log, this just suddenly started after my latest commit triggered a build of my CDK Pipeline where I was using CDK 2.39.0. I also am now seeing the synth step failing on my local dev environment as well and installing CDK 2.40.0 did not seem to resolve the error either.

2022/09/02 17:42:50 Running command cdk synth

144 | jsii.errors.JavaScriptError:
145 | @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
146 | ├── 🛑 Failing value is an instance of aws-cdk-lib.aws_apigateway.EmptyModel
147 | │ EmptyModel { modelId: 'Empty' }
148 | ╰── 🔍 Failure reason(s):
149 | ╰─ Type 'aws-cdk-lib.aws_apigateway.EmptyModel' not found
150 | at Object.process (/tmp/tmpdm_u1x99/lib/program.js:6194:19)

...

158 | The above exception was the direct cause of the following exception:
159 |  
160 | Traceback (most recent call last):
161 | File "/codebuild/output/src197530525/src/app.py", line 10, in
162 | NextgenPipeline(app, "Nextgen", env=pipeline_env)

...

192 | raise JSIIError(resp.error) from JavaScriptError(resp.stack)
193 | jsii.errors.JSIIError: Of static property aws-cdk-lib.aws_apigateway.Model.EMPTY_MODEL: Unable to serialize value as aws-cdk-lib.aws_apigateway.IModel
194 | ├── 🛑 Failing value is an instance of aws-cdk-lib.aws_apigateway.EmptyModel
195 | │ EmptyModel { modelId: 'Empty' }
196 | ╰── 🔍 Failure reason(s):
197 | ╰─ Type 'aws-cdk-lib.aws_apigateway.EmptyModel' not found
198 |  

Expected Behavior

I am expecting the "cdk synth" command to complete successfully.

Current Behavior

Currently the "cdk synth" step is failing to complete. Below is the full log from CodeBuild during my pipeline execution:

[Container] 2022/09/02 17:41:50 Waiting for agent ping
[Container] 2022/09/02 17:41:51 Waiting for DOWNLOAD_SOURCE
[Container] 2022/09/02 17:41:51 Phase is DOWNLOAD_SOURCE
[Container] 2022/09/02 17:41:51 CODEBUILD_SRC_DIR=/codebuild/output/src197530525/src
[Container] 2022/09/02 17:41:51 YAML location is /codebuild/readonly/buildspec.yml
[Container] 2022/09/02 17:41:51 Setting HTTP client timeout to higher timeout for S3 source
[Container] 2022/09/02 17:41:51 Processing environment variables
[Container] 2022/09/02 17:41:52 No runtime version selected in buildspec.
[Container] 2022/09/02 17:41:54 Moving to directory /codebuild/output/src197530525/src
[Container] 2022/09/02 17:41:54 Configuring ssm agent with target id: codebuild:358e2836-7acb-4c8c-9210-9bb6f58d3d69
[Container] 2022/09/02 17:41:54 Successfully updated ssm agent configuration
[Container] 2022/09/02 17:41:54 Registering with agent
[Container] 2022/09/02 17:41:54 Phases found in YAML: 1
[Container] 2022/09/02 17:41:54 BUILD: 4 commands
[Container] 2022/09/02 17:41:54 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
[Container] 2022/09/02 17:41:54 Phase context status code: Message:
[Container] 2022/09/02 17:41:54 Entering phase INSTALL
[Container] 2022/09/02 17:41:54 Phase complete: INSTALL State: SUCCEEDED
[Container] 2022/09/02 17:41:54 Phase context status code: Message:
[Container] 2022/09/02 17:41:54 Entering phase PRE_BUILD
[Container] 2022/09/02 17:41:54 Phase complete: PRE_BUILD State: SUCCEEDED
[Container] 2022/09/02 17:41:54 Phase context status code: Message:
[Container] 2022/09/02 17:41:54 Entering phase BUILD
[Container] 2022/09/02 17:41:54 Running command npm install -g aws-cdk
/usr/local/bin/cdk -> /usr/local/lib/node_modules/aws-cdk/bin/cdk
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/aws-cdk/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

  • aws-cdk@2.40.0
    added 1 package from 1 contributor in 2.842s

[Container] 2022/09/02 17:42:09 Running command python -m pip install -r requirements.txt
Collecting aws-cdk-lib==2.40.0
Downloading aws_cdk_lib-2.40.0-py3-none-any.whl (61.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.9/61.9 MB 38.0 MB/s eta 0:00:00
Collecting constructs<11.0.0,>=10.0.0
Downloading constructs-10.1.94-py3-none-any.whl (56 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.4/56.4 kB 4.2 MB/s eta 0:00:00
Collecting pytest==6.2.5
Downloading pytest-6.2.5-py3-none-any.whl (280 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 280.7/280.7 kB 28.9 MB/s eta 0:00:00
Collecting syrupy==1.7.0
Downloading syrupy-1.7.0-py3-none-any.whl (38 kB)
Collecting boto3==1.20.32
Downloading boto3-1.20.32-py3-none-any.whl (131 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 131.8/131.8 kB 9.6 MB/s eta 0:00:00
Collecting aws-lambda-powertools==1.26.0
Downloading aws_lambda_powertools-1.26.0-py3-none-any.whl (173 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 173.6/173.6 kB 16.4 MB/s eta 0:00:00
Collecting requests==2.28.1
Downloading requests-2.28.1-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 kB 4.9 MB/s eta 0:00:00
Collecting beautifulsoup4==4.11.1
Downloading beautifulsoup4-4.11.1-py3-none-any.whl (128 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 128.2/128.2 kB 12.7 MB/s eta 0:00:00
Collecting publication>=0.0.3
Downloading publication-0.0.3-py2.py3-none-any.whl (7.7 kB)
Collecting jsii<2.0.0,>=1.66.0
Downloading jsii-1.67.0-py3-none-any.whl (547 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 547.4/547.4 kB 35.6 MB/s eta 0:00:00
Collecting typeguard~=2.13.3
Downloading typeguard-2.13.3-py3-none-any.whl (17 kB)
Collecting pluggy<2.0,>=0.12
Downloading pluggy-1.0.0-py2.py3-none-any.whl (13 kB)
Collecting py>=1.8.2
Downloading py-1.11.0-py2.py3-none-any.whl (98 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.7/98.7 kB 9.6 MB/s eta 0:00:00
Requirement already satisfied: attrs>=19.2.0 in /root/.pyenv/versions/3.9.12/lib/python3.9/site-packages (from pytest==6.2.5->-r requirements.txt (line 3)) (21.4.0)
Collecting toml
Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting packaging
Downloading packaging-21.3-py3-none-any.whl (40 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.8/40.8 kB 13.4 MB/s eta 0:00:00
Collecting iniconfig
Downloading iniconfig-1.1.1-py2.py3-none-any.whl (5.0 kB)
Collecting colored<2.0.0,>=1.3.92
Downloading colored-1.4.3.tar.gz (29 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting s3transfer<0.6.0,>=0.5.0
Downloading s3transfer-0.5.2-py3-none-any.whl (79 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.5/79.5 kB 2.9 MB/s eta 0:00:00
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /root/.pyenv/versions/3.9.12/lib/python3.9/site-packages (from boto3==1.20.32->-r requirements.txt (line 5)) (0.10.0)
Collecting botocore<1.24.0,>=1.23.32
Downloading botocore-1.23.54-py3-none-any.whl (8.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.5/8.5 MB 93.0 MB/s eta 0:00:00
Collecting aws-xray-sdk<3.0.0,>=2.8.0
Downloading aws_xray_sdk-2.10.0-py2.py3-none-any.whl (99 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 99.7/99.7 kB 29.3 MB/s eta 0:00:00
Collecting fastjsonschema<3.0.0,>=2.14.5
Downloading fastjsonschema-2.16.1-py3-none-any.whl (22 kB)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /root/.pyenv/versions/3.9.12/lib/python3.9/site-packages (from requests==2.28.1->-r requirements.txt (line 7)) (1.26.9)
Requirement already satisfied: certifi>=2017.4.17 in /root/.pyenv/versions/3.9.12/lib/python3.9/site-packages (from requests==2.28.1->-r requirements.txt (line 7)) (2022.6.15)
Collecting charset-normalizer<3,>=2
Downloading charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Requirement already satisfied: idna<4,>=2.5 in /root/.pyenv/versions/3.9.12/lib/python3.9/site-packages (from requests==2.28.1->-r requirements.txt (line 7)) (2.10)
Collecting soupsieve>1.2
Downloading soupsieve-2.3.2.post1-py3-none-any.whl (37 kB)
Collecting wrapt
Downloading wrapt-1.14.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (77 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 77.8/77.8 kB 2.4 MB/s eta 0:00:00
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /root/.pyenv/versions/3.9.12/lib/python3.9/site-packages (from botocore<1.24.0,>=1.23.32->boto3==1.20.32->-r requirements.txt (line 5)) (2.8.2)
Requirement already satisfied: typing-extensions<5.0,>=3.7 in /root/.pyenv/versions/3.9.12/lib/python3.9/site-packages (from jsii<2.0.0,>=1.66.0->aws-cdk-lib==2.40.0->-r requirements.txt (line 1)) (3.10.0.0)
Collecting cattrs<22.2,>=1.8
Downloading cattrs-22.1.0-py3-none-any.whl (33 kB)
Collecting pyparsing!=3.0.5,>=2.0.2
Downloading pyparsing-3.0.9-py3-none-any.whl (98 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.3/98.3 kB 1.3 MB/s eta 0:00:00
Collecting exceptiongroup
Downloading exceptiongroup-1.0.0rc9-py3-none-any.whl (12 kB)
Requirement already satisfied: six>=1.5 in /root/.pyenv/versions/3.9.12/lib/python3.9/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.24.0,>=1.23.32->boto3==1.20.32->-r requirements.txt (line 5)) (1.16.0)
Building wheels for collected packages: colored
Building wheel for colored (setup.py): started
Building wheel for colored (setup.py): finished with status 'done'
Created wheel for colored: filename=colored-1.4.3-py3-none-any.whl size=14342 sha256=6b92539979906f58ed82424ca1b92018f3ca76c7974f9757a2cf67589e284e6d
Stored in directory: /root/.cache/pip/wheels/31/7b/79/7cf37e7860649bd09d359bfbbde9084a103a35eedd8f12a592
Successfully built colored
Installing collected packages: publication, iniconfig, fastjsonschema, colored, wrapt, typeguard, toml, soupsieve, pyparsing, py, pluggy, exceptiongroup, charset-normalizer, requests, packaging, cattrs, botocore, beautifulsoup4, s3transfer, pytest, jsii, aws-xray-sdk, syrupy, constructs, boto3, aws-lambda-powertools, aws-cdk-lib
Attempting uninstall: requests
Found existing installation: requests 2.25.1
Uninstalling requests-2.25.1:
Successfully uninstalled requests-2.25.1
Attempting uninstall: botocore
Found existing installation: botocore 1.27.18
Uninstalling botocore-1.27.18:
Successfully uninstalled botocore-1.27.18
Attempting uninstall: s3transfer
Found existing installation: s3transfer 0.6.0
Uninstalling s3transfer-0.6.0:
Successfully uninstalled s3transfer-0.6.0
Attempting uninstall: boto3
Found existing installation: boto3 1.24.18
Uninstalling boto3-1.24.18:
Successfully uninstalled boto3-1.24.18
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
aws-sam-cli 1.52.0 requires requests==2.25.1, but you have requests 2.28.1 which is incompatible.
Successfully installed aws-cdk-lib-2.40.0 aws-lambda-powertools-1.26.0 aws-xray-sdk-2.10.0 beautifulsoup4-4.11.1 boto3-1.20.32 botocore-1.23.54 cattrs-22.1.0 charset-normalizer-2.1.1 colored-1.4.3 constructs-10.1.94 exceptiongroup-1.0.0rc9 fastjsonschema-2.16.1 iniconfig-1.1.1 jsii-1.67.0 packaging-21.3 pluggy-1.0.0 publication-0.0.3 py-1.11.0 pyparsing-3.0.9 pytest-6.2.5 requests-2.28.1 s3transfer-0.5.2 soupsieve-2.3.2.post1 syrupy-1.7.0 toml-0.10.2 typeguard-2.13.3 wrapt-1.14.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[notice] A new release of pip available: 22.1.2 -> 22.2.2
[notice] To update, run: pip install --upgrade pip

[Container] 2022/09/02 17:42:50 Running command cdk synth
jsii.errors.JavaScriptError:
@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)
at exports.Kernel._fromSandbox (/tmp/tmpdm_u1x99/lib/program.js:5837:29)
at exports.Kernel.sget (/tmp/tmpdm_u1x99/lib/program.js:5413:34)
at exports.KernelHost.processRequest (/tmp/tmpdm_u1x99/lib/program.js:6618:36)
at exports.KernelHost.run (/tmp/tmpdm_u1x99/lib/program.js:6592:48)
at Immediate._onImmediate (/tmp/tmpdm_u1x99/lib/program.js:6593:46)
at processImmediate (internal/timers.js:464:21)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/codebuild/output/src197530525/src/app.py", line 10, in
NextgenPipeline(app, "Nextgen", env=pipeline_env)
File "/root/.pyenv/versions/3.9.12/lib/python3.9/site-packages/jsii/_runtime.py", line 86, in call
inst = super().call(*args, **kwargs)
File "/codebuild/output/src197530525/src/nextgen/build_pipeline/nextgen_pipeline.py", line 64, in init
wave.add_stage(DeployDev(self, "Dev"))
File "/root/.pyenv/versions/3.9.12/lib/python3.9/site-packages/jsii/_runtime.py", line 86, in call
inst = super().call(*args, **kwargs)
File "/codebuild/output/src197530525/src/nextgen/build_pipeline/stages/deploy_dev.py", line 50, in init
cloudsearch(self)
File "/codebuild/output/src197530525/src/nextgen/build_pipeline/stages/deploy_dev.py", line 90, in cloudsearch
CloudSearch(
File "/root/.pyenv/versions/3.9.12/lib/python3.9/site-packages/jsii/_runtime.py", line 86, in call
inst = super().call(*args, **kwargs)
File "/codebuild/output/src197530525/src/nextgen/stacks/cloudsearch.py", line 61, in init
CloudSearchAPI(
File "/root/.pyenv/versions/3.9.12/lib/python3.9/site-packages/jsii/_runtime.py", line 86, in call
inst = super().call(*args, **kwargs)
File "/codebuild/output/src197530525/src/nextgen/constructs/cloudsearch/cloudsearch_api.py", line 163, in init
response_models={"application/json": apigateway.Model.EMPTY_MODEL},
File "/root/.pyenv/versions/3.9.12/lib/python3.9/site-packages/jsii/python.py", line 16, in get
return self.fget.get(obj, klass)()
File "/root/.pyenv/versions/3.9.12/lib/python3.9/site-packages/aws_cdk/aws_apigateway/init.py", line 19608, in EMPTY_MODEL
return typing.cast(IModel, jsii.sget(cls, "EMPTY_MODEL"))
File "/root/.pyenv/versions/3.9.12/lib/python3.9/site-packages/jsii/_kernel/init.py", line 148, in wrapped
return _recursize_dereference(kernel, fn(kernel, *args, **kwargs))
File "/root/.pyenv/versions/3.9.12/lib/python3.9/site-packages/jsii/_kernel/init.py", line 368, in sget
return self.provider.sget(
File "/root/.pyenv/versions/3.9.12/lib/python3.9/site-packages/jsii/_kernel/providers/process.py", line 356, in sget
return self._process.send(request, GetResponse)
File "/root/.pyenv/versions/3.9.12/lib/python3.9/site-packages/jsii/_kernel/providers/process.py", line 329, in send
raise JSIIError(resp.error) from JavaScriptError(resp.stack)
jsii.errors.JSIIError: 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

Subprocess exited with error 1

[Container] 2022/09/02 17:42:58 Command did not exit successfully cdk synth exit status 1
[Container] 2022/09/02 17:42:58 Phase complete: BUILD State: FAILED
[Container] 2022/09/02 17:42:58 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: cdk synth. Reason: exit status 1
[Container] 2022/09/02 17:42:58 Entering phase POST_BUILD
[Container] 2022/09/02 17:42:58 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2022/09/02 17:42:58 Phase context status code: Message:
[Container] 2022/09/02 17:42:58 Expanding base directory path: cdk.out
[Container] 2022/09/02 17:42:58 Assembling file list
[Container] 2022/09/02 17:42:58 Expanding cdk.out
[Container] 2022/09/02 17:42:58 Expanding file paths for base directory cdk.out
[Container] 2022/09/02 17:42:58 Assembling file list
[Container] 2022/09/02 17:42:58 Expanding */
[Container] 2022/09/02 17:42:58 Found 26 file(s)
[Container] 2022/09/02 17:42:58 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED
[Container] 2022/09/02 17:42:58 Phase context status code: Message:

Reproduction Steps

run the "cdk synth" command on a CDK project that is using aws-cdk-lib.aws_apigateway.Model.EMPTY_MODEL

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.40.0

Framework Version

No response

Node.js Version

16.15.0

OS

Mac OS Montery (12.4)

Language

Python

Language Version

3.10.2

Other information

No response

@jaspotter jaspotter added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 2, 2022
@github-actions github-actions bot added the @aws-cdk/aws-apigateway Related to Amazon API Gateway label Sep 2, 2022
@peterwoodworth
Copy link
Contributor

Can you please share how you're using the empty model? It is working fine for me

@peterwoodworth peterwoodworth added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. needs-reproduction This issue needs reproduction. and removed needs-triage This issue or PR still needs to be triaged. labels Sep 2, 2022
@kornicameister
Copy link
Contributor

kornicameister commented Sep 2, 2022

ditto for me + my usage:

            method_responses=[
                agw.MethodResponse(
                    status_code='204',
                    response_models={
                        'application/json': agw.Model.EMPTY_MODEL,
                    },
                    response_parameters=cors_method_response,
                ),
                agw.MethodResponse(
                    status_code='500',
                    response_models={
                        'application/json': agw.Model.EMPTY_MODEL,
                    },
                    response_parameters=cors_method_response,
                ),
            ],

image

@kornicameister
Copy link
Contributor

Something is really off in here, I went down to 2.35 through 2.40 and in each release I am seeing this error in CICD pipeline.
That's particularly weird because I had a PR while go that was using HTTP_2_3 that was added to CloudFront around 2.37.0 and I had no errors around that EmptyModel

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Sep 3, 2022
@peterwoodworth
Copy link
Contributor

Could you post the full reproduction code you've used @kornicameister?

@peterwoodworth peterwoodworth added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Sep 3, 2022
@kornicameister
Copy link
Contributor

Not really, code is proprietary. I will try and check if I can replicate that. On the other hand: tests or synth are failing for me only in CICD. Locally synth is working and tests are green. Most likely something differs between environments. I am using python, so I will just recreate environment and see if situation from CICD happens then.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Sep 3, 2022
@kornicameister
Copy link
Contributor

Ok, I don't have a reproduction yet, I just managed to confirm that if I recreated a virtualenv (I am using python bindings) and went from 2.40.0 to 2.36.0 each time running same test and doing:

  1. npm install -g aws-cdk@...
  2. change Python's requirements.txt
  3. reinstall Python bindings

each time if has failed with:

image

so fresh environment gave me a consistent result around error.

@peterwoodworth can you try with a fresh environment too?

@cn-cit
Copy link

cn-cit commented Sep 3, 2022

you might find that your "software.amazon.jsii" has upgraded to 1.67.0. This seems to be the problem. I downgraded to 1.66.0 and the problem went away.

@kornicameister
Copy link
Contributor

@cn-cit it actually helped.
@peterwoodworth is there a way to pin 1.66.0 for now?

@cn-cit
Copy link

cn-cit commented Sep 4, 2022

I use the cdk with java as a maven project. I just added this as a dependency in the pom. Not sure how to do it with other environments.
<dependency> <groupId>software.amazon.jsii</groupId> <artifactId>jsii-runtime</artifactId> <version>1.66.0</version> </dependency>

@jaspotter
Copy link
Author

jaspotter commented Sep 4, 2022

@cn-cit @kornicameister, thanks for pointing this out. Yes, it seems that jsii 1.67.0 is culprit introducing this problem. I'm able to confirm after explicitly downgrading to jsii 1.66.0 in my requirements.txt file instead of 1.67.0 local cdk synth and my code pipeline is now working.

This matches my experience on Friday Sept 2 I first experienced this when my CDK pipeline must have pulled in jsii 1.67.0 which was also released 2 days ago. 4 hours prior to 1.67.0 being released my CDK pipeline was working fine, but then started to fail after it was released.

@ricall
Copy link

ricall commented Sep 5, 2022

Same thing is happening with the Java version of the CDK.

Caused by: software.amazon.jsii.JsiiException: 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

Pinning the JSII version to 1.66.0 fixes the issue.

@bfiorito
Copy link

bfiorito commented Sep 5, 2022

Hi guys,
Same issue with JAVA cdk 2.8.0. Build worked fine until friday morning, then we got this error :
Caused by: software.amazon.jsii.JsiiException: Of static property aws-cdk-lib.aws_apigateway.Model.EMPTY_MODEL: Unable to serialize value as aws-cdk-lib.aws_apigateway.IModel 03-Sep-2022 02:14:48 | ├── 🛑 Failing value is an instance of aws-cdk-lib.aws_apigateway.EmptyModel 03-Sep-2022 02:14:48 | │      EmptyModel { modelId: 'Empty' }

The version of jsii.runtime upgraded from 1.66.0 to 1.67.0 by her own. How could it be possible ?

@aamielsan
Copy link

For Gradle, we can use Gradle's dependency constraints

In build.gradle / build.gradle.kts:

dependencies {
    // ... other dependencies
    constraints {
        implementation("software.amazon.jsii:jsii-runtime:1.66.0") {
            because("version 1.67.0 has an issue impacting cdk")
        }
    }
}

@nixenos
Copy link

nixenos commented Sep 5, 2022

I can confirm that pinning jsii to version 1.66.0 works on local environments. But when trying to run it from codepipeline we get the same error after pinning jsii==1.66.0 in requirements.txt

@kornicameister
Copy link
Contributor

kornicameister commented Sep 5, 2022

@nixenos that's odd, I have a CICD and after making a change and not even clearing a cache, tests passed + synth happened.

image

@przesmak
Copy link

przesmak commented Sep 7, 2022

Hi.
I have the same issue here with Type 'aws-cdk-lib.aws_apigateway.EmptyModel' not found
Downgrade the jsii version to 1.66.0 works for me as well.

For Python users it needs to be specified explicitly under requirements.txt jsii==1.66.0 just before constracts library.

@phamngocthanhtrung
Copy link

phamngocthanhtrung commented Sep 7, 2022

This is very strange yesterday after we set the dependency implementation("software.amazon.jsii:jsii-runtime:1.66.0") everything worked and the Gitlab CI could synth without problems and since today the synth in Gitlab CI doesn't work anymore. I don't get this.

@jazeph
Copy link

jazeph commented Sep 7, 2022

@phamngocthanhtrung I had the same issue this morning and had to add exclusions to my Maven pom file to make it work again. You probably have to do something simililar.

<dependency>
	<groupId>software.amazon.awscdk</groupId>
	<artifactId>aws-cdk-lib</artifactId>
	<version>${cdk.version}</version>
	<exclusions>
		<exclusion>
			<groupId>software.amazon.jsii</groupId>
			<artifactId>jsii-runtime</artifactId>
		</exclusion>
	</exclusions>
</dependency>

<dependency>
	<groupId>software.constructs</groupId>
	<artifactId>constructs</artifactId>
	<version>${constructs.version}</version>
	<exclusions>
		<exclusion>
			<groupId>software.amazon.jsii</groupId>
			<artifactId>jsii-runtime</artifactId>
		</exclusion>
	</exclusions>
</dependency>

@nixenos
Copy link

nixenos commented Sep 8, 2022

@nixenos that's odd, I have a CICD and after making a change and not even clearing a cache, tests passed + synth happened.

image

Yeah it was issue on my part :D, pinning to 1.66.0 works in pipelines also

@zessx
Copy link

zessx commented Sep 22, 2022

You're both getting a notice. A warning that had been added since, waiting for the fix.
Not the error itself.

@iliapolo
Copy link
Contributor

Just a clarification, as mentioned by @zessx - the notice you're seeing in the CLI is not an error. It's just our way of letting you know about this important issue, that may affect your application.

You will see this as long as your framework version (aws-cdk-lib) is greater or equal to 2.41.0, even if the toolkit version is below that. You will see it even if not using APIGateway because this issue might affect other constructs as well.

As long as cdk synth is working for you, all good. Just avoid upgrading to >= 2.41.0.

Fix is in the oven.

@iliapolo
Copy link
Contributor

It does however look like the notice is being sent out to unaffected versions as well. Sorry about that, feel free to ignore if your version doesn't fall into the mentioned range.

@smislam
Copy link

smislam commented Sep 23, 2022

Hi team, Just received this message. Not sure what is happening since it didn't happen earlier today

`
NOTICES

21902 apigateway: Unable to serialize value as aws-cdk-lib.aws_apigateway.IModel

    Overview: Users of CDK in any language other than TS/JS cannot use
              values that return an instance of a deprecated class.

    Affected versions: framework: >=2.41.0, framework: >=1.172.0

    More information at: https://github.com/aws/aws-cdk/issues/21902

If you don’t want to see a notice anymore, use "cdk acknowledge ". For example, "cdk acknowledge 21902".
$ cdk --version
2.43.0 (build 487870a)
`

@rafaelCarinha
Copy link

I g

Hi team, Just received this message. Not sure what is happening since it didn't happen earlier today

` NOTICES

21902 apigateway: Unable to serialize value as aws-cdk-lib.aws_apigateway.IModel

    Overview: Users of CDK in any language other than TS/JS cannot use
              values that return an instance of a deprecated class.

    Affected versions: framework: >=2.41.0, framework: >=1.172.0

    More information at: https://github.com/aws/aws-cdk/issues/21902

If you don’t want to see a notice anymore, use "cdk acknowledge ". For example, "cdk acknowledge 21902". $ cdk --version 2.43.0 (build 487870a) `

I just got the same message now, trying to deploy

@jy-metservice
Copy link

The message is appearing even if you aren't using any of the aws_apigateway* modules at all.

@nagkumar
Copy link

+1

1 similar comment
@martsbradley
Copy link

👍

@iliapolo
Copy link
Contributor

iliapolo commented Sep 23, 2022

We fixed the notice. It should not be sent anymore if you framework version is not in these ranges:

  • >=2.41.0 <=2.43.0

Please note though, it will be shown even if you're not using apigateway. This is intentional as is NOT an error. This issue might be causing the same problem with other constructs, so its better to be aware of it.

@iliapolo
Copy link
Contributor

A new version of jsii has been released that solves this issue: https://github.com/aws/jsii/releases/tag/v1.68.0

I've updated the workaround to pin your jsii version to 1.68.0. We are working on releasing a patch version of the CDK so this pinning won't be necessary.

@nagkumar
Copy link

nagkumar commented Sep 23, 2022

I still see the same issue with pom.xml

<dependencies>
   <dependency>
       <groupId>software.amazon.awscdk</groupId>
       <artifactId>aws-cdk-lib</artifactId>
       <version>2.43.0</version>
   </dependency>

   <dependency>
       <groupId>software.constructs</groupId>
       <artifactId>constructs</artifactId>
       <version>10.1.110</version>
   </dependency>

   <dependency>
       <groupId>software.amazon.jsii</groupId>
       <artifactId>jsii-runtime</artifactId>
       <version>1.68.0</version>
   </dependency>

   <!-- https://mvnrepository.com/artifact/junit/junit -->
   <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>4.13.2</version>
       <scope>test</scope>
   </dependency>
   </dependencies>
   
CDK NPM Version : 2.43.0 (build 487870a)

node -v
v18.9.0

The same issue running the example https://github.com/aws-samples/aws-cdk-examples/tree/master/java/hello-world

\java\hello-world>cdk ls
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.amazonaws.cdk:hello-cdk >---------------------
[INFO] Building hello-cdk 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:3.1.0:java (default-cli) @ hello-cdk ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  25.084 s
[INFO] Finished at: 2022-09-23T14:08:30+05:30
[INFO] ------------------------------------------------------------------------
hello-cdk

NOTICES

21902   apigateway: Unable to serialize value as aws-cdk-lib.aws_apigateway.IModel

        Overview: Users of CDK in any language other than TS/JS cannot use
                  values that return an instance of a deprecated class.

        Affected versions: framework: >=2.41.0 <=2.43.0, framework: >=1.172.0 <= 1.174.0

        More information at: https://github.com/aws/aws-cdk/issues/21902


If you don’t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge 21902".

aws cli version is

java\ecs\fargate-load-balanced-service>aws --version
aws-cli/2.7.34 Python/3.9.11 Windows/10 exe/AMD64 prompt/off

@iliapolo
Copy link
Contributor

One more correction: v1 is not actually susceptible to this. If you are using v1, you shouldn't be seeing the notice anymore.

@mergify mergify bot closed this as completed in #22204 Sep 23, 2022
mergify bot pushed a commit that referenced this issue Sep 23, 2022
…for non TS / JS language (#22204)

See https://github.com/aws/jsii/releases/tag/v1.68.0

Fixes #21902

----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

iliapolo added a commit that referenced this issue Sep 23, 2022
…for non TS / JS language (#22204)

See https://github.com/aws/jsii/releases/tag/v1.68.0

Fixes #21902

----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@iliapolo
Copy link
Contributor

Fixed in https://github.com/aws/aws-cdk/releases/tag/v2.43.1

@dennisjbell
Copy link

I am encountering this in v2.43.1:

21902   apigateway: Unable to serialize value as aws-cdk-lib.aws_apigateway.IModel

        Overview: Users of CDK in any language other than TS/JS cannot use
                  values that return an instance of a deprecated class.

        Affected versions: framework: >=2.41.0 <=2.43.0

        More information at: https://github.com/aws/aws-cdk/issues/21902


If you don’t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge 21902".
$ cdk --version
2.43.1 (build c1ebb85)

@mattsoftware
Copy link

I updated to v2.43.1 as well as the jsii to 1.68.0 and the message went away for me (if that helps)

require (
	github.com/aws/aws-cdk-go/awscdk/v2 v2.43.1
	github.com/aws/constructs-go/constructs/v10 v10.1.102
	github.com/aws/jsii-runtime-go v1.68.0
)

chrispy2day added a commit to chrispy2day/amazon-sagemaker-automatic-deploy-mlflow-model that referenced this issue Oct 14, 2022
@kaizencc kaizencc unpinned this issue Oct 24, 2022
mergify bot pushed a commit that referenced this issue Nov 30, 2022
We've recently seen lots of [confusion](#21902) from our users thinking the sheer display of the notice constitutes an error.
Try to clarify this isn't the case. 

----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
brennanho pushed a commit to brennanho/aws-cdk that referenced this issue Dec 9, 2022
We've recently seen lots of [confusion](aws#21902) from our users thinking the sheer display of the notice constitutes an error.
Try to clarify this isn't the case. 

----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@sathyan13
Copy link

I am encountering this warning in v2.55.1.

21902 apigateway: Unable to serialize value as aws-cdk-lib.aws_apigateway.IModel

    Overview: Users of CDK in any language other than TS/JS cannot use
              values that return an instance of a deprecated class.

    Affected versions: framework: >=2.41.0 <=2.43.0

    More information at: https://github.com/aws/aws-cdk/issues/21902

brennanho pushed a commit to brennanho/aws-cdk that referenced this issue Jan 20, 2023
We've recently seen lots of [confusion](aws#21902) from our users thinking the sheer display of the notice constitutes an error.
Try to clarify this isn't the case. 

----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
brennanho pushed a commit to brennanho/aws-cdk that referenced this issue Feb 22, 2023
We've recently seen lots of [confusion](aws#21902) from our users thinking the sheer display of the notice constitutes an error.
Try to clarify this isn't the case. 

----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. management/tracking Issues that track a subject or multiple issues p0
Projects
None yet