Skip to content

Link aws-cdk-lib versions between node and Python #218

@gadomski

Description

@gadomski

I've run into problems when the node version of aws-cdk-lib used to build the Python bindings differs from the version used in a Python project that's deploying via eoapi-cdk. In particular, breaking changes to the aws-cdk-lib can lead to hard-to-debug tracebacks like this one, which occurred because of a breaking change v2.224.0 of eoapi-cdk:

 Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/runner/work/ava-backend/ava-backend/infrastructure/aws/app.py", line 6, in <module>
    from .stacks.app import AppStack
  File "/home/runner/work/ava-backend/ava-backend/infrastructure/aws/stacks/app.py", line 8, in <module>
    from eoapi_cdk import (
  File "/home/runner/work/ava-backend/ava-backend/.venv/lib/python3.12/site-packages/eoapi_cdk/__init__.py", line 1043, in <module>
    class PgStacDatabase(
  File "/home/runner/work/ava-backend/ava-backend/.venv/lib/python3.12/site-packages/eoapi_cdk/__init__.py", line 1122, in PgStacDatabase
    storage_encryption_key: typing.Optional[_aws_cdk_aws_kms_ceddda9d.IKeyRef] = None,
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'aws_cdk.aws_kms' has no attribute 'IKeyRef'

The simplest solution might just be explicitly pinning the aws-cdk-version in both package.json and as a required dependency in pyproject.toml (it's currently optional), but there maybe be a more elegant way? I'm also curious why aws-cdk-lib isn't a required dependency of the Python package to begin with...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions