I have a Cloud Function in python 3.9 that calls this code :
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 ""
And here is the log i have from Cloud logging when i call my function with a valid firebase id token :
ERROR:root:check_token : 'HTTPResponse' object has no attribute 'strict'
What does it mean please ?
Note : i have 10 cloud functions, only one has this issue and there is no differences with the others...
ChatGPT says it's an error with Firebase authentication backend and to contact firbease support, but since this happens only in one of my Cloud Functions i would like to understand if i am doing something wrong.
PS : If i run this cloud function locally everything is fine with functions-framework --target function_name --debug --port=8080
with the exact same code.
I had a similar issue and someone pointed me to this: https://github.com/psf/requests/issues/6437 and also for firebase specifically: https://github.com/firebase/firebase-admin-python/issues/699
Apparently there's been a breaking change to the library and one solution is to use urllib3 2.0.0 as a workaround which I am yet to try (Not sure how given I'm dependent on Firebase).
You can see my question here: Firebase Authentication: 'HTTPResponse' object has no attribute 'strict', status: error