AWS Lambda Bigquery Storage Module Import Issue

0

Hi, I am facing following issue when I try to import Bigquey_storage module in Lambda.

"errorMessage": "Unable to import module 'lambda_function': cannot import name 'cygrpc' from 'grpc._cython' (/opt/python/grpc/_cython/__init__.py)",
  "errorType": "Runtime.ImportModuleError"

I have created the layer with the same Python runtime as in my lambda. I am using python 3.9 for my lambda and the layer. I tried installing grpcio module explicitly in the layer package. But it did not help.

Prior to this I created Google Cloud Big Query package, and it worked just fine.

Regards

질문됨 일 년 전509회 조회
2개 답변
0
수락된 답변

After doing some research, it was suggested in a post to use the same OS to create the layer, that is used for lambda runtime. If you look at lambda runtimes, you can see that OS used in the runtimes is either Amazon Linux or Amazon Linux 2.

[https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html] (Lambda Runtimes).

So, I created a Virtual Machine with Amazon Linux 2 image and created the layer package on that machine. Now it works perfectly in the Lambda Function. I hope this helps.

답변함 일 년 전
0

It seems like there is an issue with the grpc library in your Lambda function. Here are some steps you can try to resolve the issue:

  1. Make sure that you have installed the correct version of the grpc library that is compatible with Python 3.9. You can try upgrading to the latest version of the library to see if that resolves the issue.
  2. Check if you have added all the necessary dependencies to your Lambda layer. It is possible that you may be missing some dependencies that are required by the grpc library.
  3. Check if there are any conflicting dependencies between the grpc library and other libraries that you may have installed in your Lambda function. You can try removing all other libraries and see if the issue still persists.
  4. You can also try deploying your Lambda function with a newer version of the AWS Lambda runtime that may have better compatibility with the grpc library.
hash
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인