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

Python sample app is broken in 0.36.0 #3069

Closed
1 of 5 tasks
senorkrabs opened this issue Jun 26, 2019 · 5 comments · Fixed by #3071
Closed
1 of 5 tasks

Python sample app is broken in 0.36.0 #3069

senorkrabs opened this issue Jun 26, 2019 · 5 comments · Fixed by #3071

Comments

@senorkrabs
Copy link

senorkrabs commented Jun 26, 2019

Note: for support questions, please first reference our documentation, then use Stackoverflow. This repository's issues are intended for feature requests and bug reports.

  • I'm submitting a ...

    • 🪲 bug report
    • 🚀 feature request
    • 📚 construct library gap
    • ☎️ security issue or vulnerability => Please see policy
    • ❓ support request => Please see note at the top of this template.
  • What is the current behavior?
    If the current behavior is a 🪲bug🪲: Please provide the steps to reproduce
    Install cdk 0.3.6

cdk init sample-app --language=python
source .env/bin/activate
python3 -m pip install -r requirements.txt 
cdk synth
Traceback (most recent call last):
  File "app.py", line 5, in <module>
    from hello.hello_stack import MyStack
  File "/home/ec2-user/environment/test2/hello/hello_stack.py", line 9, in <module>
    from hello_construct import HelloConstruct
  File "/home/ec2-user/environment/test2/hello/hello_construct.py", line 8, in <module>
    class HelloConstruct(cdk.Construct):
**AttributeError: module 'aws_cdk.cdk' has no attribute 'Construct'**
Subprocess exited with error 1
  • What is the expected behavior (or behavior of feature suggested)?
    cdk synth should succeed

  • What is the motivation / use case for changing the behavior or adding this feature?

  • Please tell us about your environment:

    • CDK CLI Version:0.36.0
    • Module Version: xx.xx.xx
    • OS: Amazon Linux (Code9)
    • Language: [Python ]
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)
    It appears the change from aws-cdk.cdk in 0.36.0 broke the sample-app and needs to be updated.

It also appears there is a change to the sqs.Queue class that breaks hello_construct.py. Specicially, visibility_timeout_secs was renamed visbility_timeout and expects an object instead of int.

@sdole
Copy link

sdole commented Jun 26, 2019

Same for me. I installed cdk this morning. At that time it was 0.35. I wrote my app modeled on the sample app. Later in the day, I had to install cdk for cloudformation. At that point my cdk got upgraded to 0.36. That time I got the same error.

@senorkrabs
Copy link
Author

senorkrabs commented Jun 26, 2019

Same for me. I installed cdk this morning. At that time it was 0.35. I wrote my app modeled on the sample app. Later in the day, I had to install cdk for cloudformation. At that point my cdk got upgraded to 0.36. That time I got the same error.

To workaround in the sample app:

  • Change all imports of cdk, to core, in app.py, hello_construct.py, and hello_stack.py
  • Replace all cdk. to core. in the same 3 python scripts
  • Change visibility_timeout_secs=300 to visibility_timeout=core.Duration.seconds(300) in hello_construct.py
  • Replace App.run() with App.synth() at the end of the app.py script

Have fun!

@sdole
Copy link

sdole commented Jun 26, 2019

Worked. I didn't change visibility_timeout_secs. What is that for?

@senorkrabs
Copy link
Author

That’s the visibility timeout setting on the SQS queue that’s created in the sample app. Perhaps you aren’t using it?

shivlaks added a commit that referenced this issue Jun 26, 2019
follow up on #3058 - since we renamed the core package namesapce to "software.amazon.awscdk.core"

Fixes #3069
@shivlaks
Copy link
Contributor

Hey @senorkrabs
Thanks for reporting this issue as well as providing a workaround!

PR with fix: #3071

eladb pushed a commit that referenced this issue Jun 26, 2019
follow up on #3058 - since we renamed the core package namesapce to "software.amazon.awscdk.core"

Fixes #3069
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

Successfully merging a pull request may close this issue.

3 participants