我在python3.9中有一个Cloud函数,它调用以下代码:
firebase_admin.initialize_app()
def check_token(token, app_check_token):
"""
:param app_check_token:
:param token:
:return:
"""
try:
app_token = app_check.verify_token(app_check_token)
logging.info(f"App check token verified : {app_token}")
except Exception as e:
logging.error(f"Exception while decoding app check token : {e}")
try:
decoded_token = auth.verify_id_token(token)
logging.info(f"verified token : {decoded_token}")
if "uid" in decoded_token:
return decoded_token["uid"]
return ""
except Exception as e:
logging.error(f"check_token : {e}")
return ""
下面是我在使用有效的Firebase id令牌调用函数时从Cloud Logging获得的日志(log):
ERROR:root:check_token : 'HTTPResponse' object has no attribute 'strict'
这是什么意思?
注:我有10个云函数,只有一个有这个问题,与其他没有区别…
ChatGPT说这是Firebase身份验证后端的错误,并联系Firbease支持人员,但由于这种情况只发生在我的一个Cloud函数中,我想知道我是否做错了什么.
PS:如果我在本地运行这个云函数,使用 functions-framework --target function_name --debug --port=8080
和完全相同的代码,一切都很好.