AWS Lambda上的Firebase导入错误 [英] Firebase on AWS Lambda Import Error
问题描述
我正在尝试将Firebase与AWS Lambda连接.我正在使用他们的 firebase-admin
sdk.我已经按照此处.但是我在Lambda上收到此错误:
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.
我以前也曾尝试使用node.js设置类似的功能,但由于未配置 GRPC
,因此收到一条错误消息.我认为此错误消息可能源于同一问题.我不知道该如何解决.我已经尝试过:
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/...
并安装 google-cloud-firestore
,但均未解决问题.从终端运行代码时,没有任何错误.
and installing google-cloud-firestore
, but neither fixed the problem. When I run the code from my terminal, I get no errors.
推荐答案
部分问题在于grpcio会编译平台特定的动态模块: cygrpc.cpython-37m-darwin.so
(在我的情况).根据此响应,您无法在zip文件中导入动态模块: https://stackoverflow.com/a/58140801
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
这篇关于AWS Lambda上的Firebase导入错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!