首页 > 解决方案 > 托管在应用程序引擎上的 Python 应用程序无法与在本地工作的 Firestore 连接

问题描述

我在 GCP 上创建了一个新项目。我正在尝试从 Python 烧瓶应用程序的 firestore(已经处于本机模式)中选择/添加数据。来自本地环境。我能够连接到 Firestore。但是一旦我在 App 引擎上托管了我的应用程序,我的 API 就无法连接到 Firestore。它抛出以下错误:

TypeError:with_scopes_if_required() 得到了一个意外的关键字参数“default_scopes”

_create_composite_credentials (/layers/google.python.pip/pip/lib/python3.7/site-packages/google/api_core/grpc_helpers.py:238)

我不确定我在这里缺少什么。我感谢任何支持。

谢谢

标签: pythongoogle-app-enginegoogle-cloud-firestore

解决方案


我也遇到了同样的问题,今天刚刚解决。

正如您在更新日志中看到的那样https://googleapis.dev/python/google-api-core/latest/changelog.html最近他们更新了对google-authlib 的要求。您需要检查您的 requirements.txt。就我而言,我们固定了两个没有直接使用的库。

google-auth==1.21.1
google-auth-oauthlib==0.4.1

我刚刚从 中删除了它们,requirements.txt以便自动处理依赖项版本,它解决了这个问题。

所以我想这取决于您的情况,取决于您如何管理依赖项,但您可能想要使用google-auth版本。


推荐阅读