首页 > 解决方案 > firebase_admin auth delete_user 突然无法按预期工作

问题描述

我有一段代码在很长一段时间内每天自动运行两次。在上周的某个时候,我一直使用的 auth.delete_user 方法开始失败,并返回错误。有谁知道发生了什么变化,或者我做错了什么?文档中的任何内容似乎都没有改变。

我回来的错误是:

Server response: {
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"local_id\": Proto field is not repeating, cannot start list.",
    "errors": [
      {
        "message": "Invalid JSON payload received. Unknown name \"local_id\": Proto field is not repeating, cannot start list.",
        "domain": "global",
        "reason": "badRequest"
      }
    ],
    "status": "INVALID_ARGUMENT"
  }
}

一个人为的代码示例是:

from firebase_admin import credentials
from firebase_admin import auth
from firebase_admin import db

try:
    cred = credentials.Certificate("serviceAccountKey.json")
    firebase_admin.initialize_app(cred, {
        'databaseURL': 'https://[project].firebaseio.com'
    })
except Exception as e:
    f.write(str(e.message))

uid = 'some valid UID string'
user = auth.delete_user(uid)

任何对出了什么问题的见解将不胜感激!

标签: firebase-authenticationfirebase-admin

解决方案


对此的底层实现实际上是不正确的。这在不久前得到了修复

您应该已经收到一封电子邮件来升级您的 python admin sdk 版本。升级到最新版本应该可以解决这个问题。


推荐阅读