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

Failed to create CDK project in CDK >= 2.73.0 #2088

Open
ShotaOki opened this issue Dec 31, 2023 · 0 comments
Open

Failed to create CDK project in CDK >= 2.73.0 #2088

ShotaOki opened this issue Dec 31, 2023 · 0 comments

Comments

@ShotaOki
Copy link

procedure

  1. Install libraries.
    -> Reference :: https://aws.github.io/chalice/tutorials/cdk.html
npm install -g aws-cdk

python3 -m pip install chalice "chalice[cdkv2]"
  1. chalice new-project

Select [CDK] REST API with DynamoDB backend

  1. deploy
python3 -m pip install -r requirements.txt

cdk deploy

Result

Failed to deploy. Traceback

Traceback (most recent call last):
  File "/home/USERNAME/ChaliceA4AB/example/jp/sandwich-shop/infrastructure/app.py", line 4, in <module>
    from aws_cdk import core as cdk
  File "/home/USERNAME/.local/lib/python3.9/site-packages/aws_cdk/core/__init__.py", line 7501, in <module>
    class ConstructNode(metaclass=jsii.JSIIMeta, jsii_type="@aws-cdk/core.ConstructNode"):
  File "/home/USERNAME/.local/lib/python3.9/site-packages/aws_cdk/core/__init__.py", line 7560, in ConstructNode
    runtime_info: typing.Optional[typing.Union[_aws_cdk_cx_api_9a62db47.RuntimeInfo, typing.Dict[builtins.str, typing.Any]]] = None,
AttributeError: module 'aws_cdk.cx_api' has no attribute 'RuntimeInfo'

Reason

CDK v2.72.0 has no package aws_cdk.core
https://github.com/aws/aws-cdk/tree/v2.72.0/packages/aws-cdk-lib/core

But CDK v2.73.0 later, package has aws_cdk.core
https://github.com/aws/aws-cdk/tree/v2.73.0/packages/aws-cdk-lib/core

Chalice determines the version in this way. But 2.73.0 later, this source does not work correctly.

try:
    from aws_cdk import core as cdk # As V1
except ImportError:
    import aws_cdk as cdk # As V2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant