我正在尝试在我现有的无服务器AWS Lambda应用程序中使用Google Cloud Firestore。
这是我所做的。
我已经在requirement.txt中添加库(google-cloud-firestore),我已经完成了所需的设置,并添加了creds json文件。我使用'serverless-python-requirements‘和docker部署来部署应用程序。
我可以在我的本地环境中很好地运行一切,但是当我在AWS lambda上部署它时,我得到以下错误。
module initialization error: The 'google-cloud-firestore' distribution was not found and is required by the application我试了很多。我甚至尝试过派生google cloud python代码库,并在调用pkg_resources.get_distribution的地方设置静态值。这似乎是可行的,但不是正确的解决方案。这是指向fork和edit的链接。https://github.com/AmitChotaliya/google-cloud-python/commit/f23539f0905721f2b1b11d2439e351d438f541dd#diff-5e99793fe69a94f0f27267a2fba86306
发布于 2019-03-21 12:34:52
我已经找到了解决方案。这就是我做错的地方。
我使用的是无服务器框架,我使用' serverless -python-requirements‘和docker部署来部署应用程序。
我的配置如下
custom:
wsgi:
app: app.app
packRequirements: false
pythonRequirements:
dockerizePip: non-linux
slim: true问题出在slim: true,它排除了.so文件。我移除了它,它工作得很好。
https://stackoverflow.com/questions/54378453
复制相似问题