问题
I am trying to connect Firebase with an AWS Lambda. I am using their firebase-admin
sdk. I have installed and created the dependancy package as described here. But I am getting this error on Lambda:
Unable to import module 'index':
Failed to import the Cloud Firestore library for Python.
Make sure to install the "google-cloud-firestore" module.
I have previously also tried setting up a similar function using node.js but I received an error message because GRPC
was not configured. I think that this error message might be stemming from that same problem. I don't know how to fix this. I have tried:
pip install grpcio -t path/to/...
and installing google-cloud-firestore
, but neither fixed the problem. When I run the code from my terminal, I get no errors.
回答1:
Part of the problem here is that grpcio compiles a platform specific dynamic module: cygrpc.cpython-37m-darwin.so
(in my case). According to this response you cannot import dynamic modules in a zip file: https://stackoverflow.com/a/58140801
来源:https://stackoverflow.com/questions/51391458/firebase-on-aws-lambda-import-error