Google_Application_credentials ist auch nach dem Einstellen von env_variables in app.yaml null
Posted: 12 Mar 2025, 03:08
Ich stelle eine Flask -Anwendung für die Google App Engine (Standardumgebung, Python 3.9) bereit. />
Dies bestätigt, dass die Service -Kontodatei in der App Engine -Instanz vorliegt, aber die Umgebungsvariable fehlt.
Code: Select all
gcloud app describe --format=json | jq '.envVariables'
returns:
null
i
< /code>
ndicating, dass die Umgebungsvariable nicht korrekt eingestellt wurde.import os
from flask import jsonify
@app.route("/debug")
def debug():
file_exists = os.path.exists("./firebase_credentials.json")
return jsonify({
"GOOGLE_APPLICATION_CREDENTIALS": os.getenv("GOOGLE_APPLICATION_CREDENTIALS"),
"firebase_credentials_exists": file_exists
}), 200
< /code>
Gibt zurück: < /p>
{
"GOOGLE_APPLICATION_CREDENTIALS": null,
"firebase_credentials_exists": true
}