AWS Lambda to Firestore error: cannot import name 'cygrpc'

前端 未结 2 401
长情又很酷
长情又很酷 2021-01-14 01:25

On my AWS Lambda Python 3.6 function I\'d like to use Google Firestore (Cloud Firestore BETA) for caching purposes, but as soon as I add

from google.cloud im         


        
相关标签:
2条回答
  • 2021-01-14 02:09

    Ran into same issue, i solved it by using the plugin serverless-python-requirements for serverless framework and passing:

    pythonRequirements:
        dockerizePip: true
    

    Essentially this installs your c-based packages (and all other packages) in a docker container where it would work and then symlinks them to your lambda fn.

    A helpful guide can be found on: https://serverless.com/blog/serverless-python-packaging/

    Plugin: https://github.com/UnitedIncome/serverless-python-requirements

    0 讨论(0)
  • 2021-01-14 02:22

    The python client for Firestore relies on the C-based implementation of GRPC. This appears not to work by default in AWS Lambda.

    Node.js users have reported similar problems and they've documented a workaround of building a docker image.

    This should be similar to any getting any other python package that requires native code to work. Perhaps something like this method for getting scikit to work?

    I hope this is enough to get you going in the right direction, but unfortunately I don't know anything about AWS Lambda :-(.

    0 讨论(0)
提交回复
热议问题