Google Firestore python库在AWS lamb中不工作

2024-09-30 20:24:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试在我现有的无服务器AWS Lambda应用程序中使用googlecloudfirestore。在

这是我所做的。在

我已经在要求.txt 我已经完成了所需的设置并添加了creds json文件。 我使用'ServerlessPython requirements'和docker部署进行应用程序部署。在

我可以在我的本地环境中运行一切,但是当我在AWS lambda上部署它时,我得到了以下错误。在

module initialization error: The 'google-cloud-firestore' distribution was not found and is required by the application

我试了很多次。我甚至尝试过分叉googlecloudpython repo并设置调用pkg_resources.get_distribution的静态值。这似乎有效,但不是正确的解决办法。 这是指向fork和edit的链接。https://github.com/AmitChotaliya/google-cloud-python/commit/f23539f0905721f2b1b11d2439e351d438f541dd#diff-5e99793fe69a94f0f27267a2fba86306


Tags: 文件lambda服务器txtawsjson应用程序cloud
1条回答
网友
1楼 · 发布于 2024-09-30 20:24:08

我找到了解决办法。这就是我做错的地方。在

我使用的是serverless框架,我使用的是“serverless python requirements”和docker部署来进行应用程序部署。在

我的配置如下

custom:
  wsgi:
    app: app.app
    packRequirements: false
  pythonRequirements:
    dockerizePip: non-linux
    slim: true

问题是slim: true,它排除了.so文件。我把它取下来,效果很好。在

相关问题 更多 >