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

Contract tests failing with error "cannot import name 'verify_interface' from 'cryptography.utils' (/var/task/cryptography/utils.py)^MTraceback (most recent call last):" #981

Closed
kurdekar opened this issue Mar 27, 2023 · 10 comments

Comments

@kurdekar
Copy link

Contract tests are failing with below error:

[ERROR] Runtime.ImportModuleError: Unable to import module 'cfnregistryresource.handlers': cannot import name 'verify_interface' from 'cryptography.utils' (/var/task/cryptography/utils.py)^MTraceback (most recent call last):

This was working fine until Thursday 23rd March. There are other CloudFormation custom resources that were created prior to this date are also working fine.

I do not see a 'verify_interface' function in the file ./build/cryptography/utils.py for this resource. However, other resources created before yesterday have this function available in utils.py

All new builds since Friday are failing. I have setup a new build environment and also tried the workaround here: SecurityInnovation/PGPy#402.

@kddejong
Copy link
Contributor

Are you working on a python based extension?

aws-cloudformation/cloudformation-cli-python-plugin#253

@kddejong
Copy link
Contributor

You can force a version of cryptography<40.0.0 in your requirements.txt file

@kurdekar
Copy link
Author

yes, I am using python based extension. Forcing a lower version in requirements.txt helped. The contract tests are working fine now. Thank you.

@kddejong
Copy link
Contributor

I'm glad you are unblocked. @kurdekar when we release the newer version of the python plugin you won't have to pin anymore so this is a workaround.

@colonmelvin
Copy link

This also appears to impact CloudFormation Hooks. While I'm able to package them successfully with cfn submit --dry-run I find the same error from above when the hook is invoked. Adding cryptography<40.0.0 to requirements.txt resolved the issue.

cannot import name 'verify_interface' from 'cryptography.utils'

@mrinaudo-aws
Copy link
Contributor

@kurdekar @colonmelvin on the current workaround (that @kddejong mentioned above): I saw this newly-merged PR that took a new course (unpinning the version for cryptography, and using a new version of the aws-encryption-sdk). I have mimicked the approach of that PR, and temporarily added aws-encryption-sdk==3.1.1 to one of my requirements.txt files in the interim to be able to run my tests without that error.

@mrinaudo-aws
Copy link
Contributor

Hi @kurdekar @colonmelvin @kddejong - both the Python plugin and lib are now updated - you should be able to update them on your machines using pip, and have the following:

  • aws-encryption-sdk-3.1.1
  • cloudformation-cli-python-lib-2.1.16
  • cloudformation-cli-python-plugin-2.1.8

You should be able to remove the additional line in the requirements.txt file, and try again without it - it worked for me. Let us know!

@colonmelvin
Copy link

Hi @kurdekar @colonmelvin @kddejong - both the Python plugin and lib are now updated - you should be able to update them on your machines using pip, and have the following:

  • aws-encryption-sdk-3.1.1
  • cloudformation-cli-python-lib-2.1.16
  • cloudformation-cli-python-plugin-2.1.8

You should be able to remove the additional line in the requirements.txt file, and try again without it - it worked for me. Let us know!

Awesome, thanks @mrinaudo-aws! Will give this a go once I'm back in the office next week.

@mmaeng
Copy link
Contributor

mmaeng commented May 9, 2023

The release should have resolved the dependency issue @colonmelvin ! Will close this issue out but please reopen if you are still blocked!

@mmaeng mmaeng closed this as completed May 9, 2023
@colonmelvin
Copy link

The release should have resolved the dependency issue @colonmelvin ! Will close this issue out but please reopen if you are still blocked!

Just confirming all is working well now, I've removed the pinned version cryptography and was able to build/deploy hooks as expected. Thanks!

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

5 participants