Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

botocore package in lambda python 3.9 runtime return error: "cannot import name "'DEPRECATED_SERVICE_NAMES'" from 'botocore.docs'"

I am using Lambda Python 3.9 runtimes. I also use boto3 and botocore default packages in Lambda.

Today, I suddenly got this error: "cannot import name "'DEPRECATED_SERVICE_NAMES'" from 'botocore.docs'". I only succeeded in fixing it when I added the botocore package to the lambda runtime. I want to avoid it since it increases the size of the layer by 10 MB.

Any help? thanks

like image 791
Elad Hazan Avatar asked Sep 10 '25 21:09

Elad Hazan


1 Answers

There is an issue with the latest releases of boto3. You can see the issue here: https://github.com/boto/boto3/issues/3648. You need to downgrade boto3 version in your lambda. For this include a lower version of boto3 in your requirements.txt file. For example, boto3==1.26.90 worked for me. Hope it helps.

like image 175
denis_smyslov Avatar answered Sep 12 '25 12:09

denis_smyslov