람다 코드 수정 반영시 에러 문제.

0

안녕하세요.

람다 사용중 최근에 코드를 수정하여 deploy 하면 아래와 같은 에러가 발생합니다. 레이어(Pandas, Numpy 등)를 포함하고 있는 함수입니다.

boro3 가 버전업이 되면서 발생하는 문제인것 같습니다. 이전에는 문제가 없었습니다.

어떻게 해결할수 있을까요?

Response { "errorMessage": "Unable to import module 'lambda_function': cannot import name 'DEPRECATED_SERVICE_NAMES' from 'botocore.docs' (/opt/python/lib/python3.8/site-packages/botocore/docs/init.py)", "errorType": "Runtime.ImportModuleError", "stackTrace": [] }

Function Logs START RequestId: 1c801880-6e1d-4794-a1a3-350ee99ad4fd Version: $LATEST LAMBDA_WARNING: Unhandled exception. The most likely cause is an issue in the function code. However, in rare cases, a Lambda runtime update can cause unexpected function behavior. For functions using managed runtimes, runtime updates can be triggered by a function change, or can be applied automatically. To determine if the runtime has been updated, check the runtime version in the INIT_START log entry. If this error correlates with a change in the runtime version, you may be able to mitigate this error by temporarily rolling back to the previous runtime version. For more information, see https://docs.aws.amazon.com/lambda/latest/dg/runtimes-update.html [ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': cannot import name 'DEPRECATED_SERVICE_NAMES' from 'botocore.docs' (/opt/python/lib/python3.8/site-packages/botocore/docs/init.py) Traceback (most recent call last):END RequestId: 1c801880-6e1d-4794-a1a3-350ee99ad4fd REPORT RequestId: 1c801880-6e1d-4794-a1a3-350ee99ad4fd Duration: 1.50 ms Billed Duration: 2 ms Memory Size: 128 MB Max Memory Used: 56 MB

Request ID 1c801880-6e1d-4794-a1a3-350ee99ad4fd

Jinsoo
已提問 1 個月前檢視次數 393 次
1 個回答
0

github 를 찾아보니, 이 오류는 boto3와 botocore 버전 간의 불일치로 인해 발생했을 가능성이 높다고 생각합니다.
https://github.com/boto/boto3/issues/4058#issuecomment-2013844631

아래의 방법으로 해결되는지 한번 시도해보는것도 좋을것 같습니다.
https://docs.aws.amazon.com/lambda/latest/dg/python-package.html#python-package-create-dependencies
https://docs.aws.amazon.com/lambda/latest/dg/python-package.html#python-package-dependencies-layers

AWS
專家
hyp
已回答 1 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南