question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws_cdk.aws_codecommit): AttributeError: module 'aws_cdk.aws_codecommit' has no attribute 'Code'

See original GitHub issue

Describe the bug

codecommit has a class Code per the documentation: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codecommit.Code.html

When attempting to access the class…

    repo = codecommit.Repository(
        self,
        "repo",
        repository_name="repo_name",
        description="My repo",
        code=codecommit.Code.from_directory("./mydirectory","main" )
    )

An error is returned…

File "/.../infrastructure.py", line 453, in __init__
    code=codecommit.Code.from_directory("./mydirectory","main" )
AttributeError: module 'aws_cdk.aws_codecommit' has no attribute 'Code'

Expected Behavior

codecommit successfully creates a repo initialized based on the code.

Current Behavior

An error is returned…

File "/.../infrastructure.py", line 453, in __init__
    code=codecommit.Code.from_directory("./mydirectory","main" )
AttributeError: module 'aws_cdk.aws_codecommit' has no attribute 'Code'

Reproduction Steps

    repo = codecommit.Repository(
        self,
        "repo",
        repository_name="repo_name",
        description="MWAA Dag",
        code=codecommit.Code.from_directory("./mydirectory","main" )
    )

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.20.0 (build 738ef49)

Framework Version

No response

Node.js Version

v16.6.1

OS

ProductName: macOS ProductVersion: 11.6.5 BuildVersion: 20G527

Language

Python

Language Version

Python 3.8.3

Other information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
skinny85commented, Apr 12, 2022

Yes, you were using aws-cdk-lib in version 2.2.0, while this functionality was released in version 2.4.0.

0reactions
github-actions[bot]commented, Apr 12, 2022

⚠️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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws-cdk/aws-codepipeline-actions module
This module contains Actions that allows you to deploy to CloudFormation from AWS CodePipeline. For example, the following code fragment defines a pipeline...
Read more >
awslabs/aws-cdk - Gitter
another issue I have is granting access for a new Lambda in a CDK stack access to ... AttributeError: module 'aws_cdk.core' has no...
Read more >
CDK AttributeError: module 'aws_cdk.cx_api' has no attribute ...
I believe this an error of the aws_cdk library of core is this because it thinks I am mixing AWS CDK V1 and...
Read more >
How to upgrade CDK from CDKv1 to CDKv2 in an existing ...
When working with CDK version 1, every package/module which is needed for ... aws-cdk.aws-codecommit==1.136.0 aws-cdk.aws-codebuild==1.136.0 ...
Read more >
aws-cdk-lib - npm
For CDK apps, declare them under the dependencies section only. Use in your code. Classic import. You can use a classic import to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found