2 Answers
- Newest
- Most votes
- Most comments
1
Hello.
There is a Lambda layer created by volunteers.
Using this one you may not have to create layers.
https://github.com/keithrozario/Klayers
1
I got a DEFAULT_CIPHERS' from 'urllib3.util.ssl_' error when I trying a post request from a lambda function to an external API as well. I fix the problem installing a previous version of urllib3 ( The latest version has problems with boto3 ).
Try creating a new zip file to import requests, but this time after make the pip install requests, force again the instalation of urllib3==1.26.18, like this:
pip install --target=. --implementation cp --python-version 3.10 --only-binary=:all: urllib3==1.26.18 --upgrade
After that I got rid of the problem.
answered 4 months ago
Relevant content
- asked 9 months ago
- asked 5 months ago
- asked 7 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 4 months ago
Thanks Riku I tried to add the layer to both 3.9 and 3.10 runtimes but I get the error: "Unable to import module 'lambda_function': cannot import name 'DEFAULT_CIPHERS' from 'urllib3.util.ssl_' (/opt/python/urllib3/util/ssl_.py)"
It seems somebody else had it: https://stackoverflow.com/questions/76414514/cannot-import-name-default-ciphers-from-urllib3-util-ssl-on-aws-lambda-us
and the suggestion here is to do "urllib3<2" , what does it mean? How would you proceed? Many Thanks Denis
I think it would be better to specify the version and install it as per the URL you shared. The cause of the error seems to be that "urllib3" was changed from Series 1 to Series 2 in the first half of June 2023. https://urllib3.readthedocs.io/en/stable/changelog.html#id2
https://urllib3.readthedocs.io/en/stable/v2-migration-guide.html#importerror-cannot-import-name-gaecontrib-from-requests-toolbelt-compat
Thanks Riku again, Does it mean I have to create deployment package (with urllib3<2) as in https://docs.aws.amazon.com/lambda/latest/dg/python-package.html ? So far I have used only Lambda function and Layers, do I have to open another can of worms? :) Best Regards Denis
Yes, we probably need to create a deployment package in the manner you have identified.