python - GOOGLE_APPLICATION_CREDENTIALS is null even after setting env_variables in app.yaml - Stack Overflow

I am deploying a Flask application to Google App Engine (Standard Environment, Python 3.9).I am using

I am deploying a Flask application to Google App Engine (Standard Environment, Python 3.9). I am using Firebase Admin SDK to access Firestore, and I have set GOOGLE_APPLICATION_CREDENTIALS in app.yaml to point to my service account JSON file (firebase_credentials.json).

However, after deploying the app, running:

gcloud app describe --format=json | jq '.envVariables'
returns:

null
i

ndicating that the environment variable has not been set correctly.

Additionally, my Flask debug endpoint:

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

returns:

{
    "GOOGLE_APPLICATION_CREDENTIALS": null,
    "firebase_credentials_exists": true
}

This confirms that the service account file is present in the App Engine instance but the environment variable is missing.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744772392a4592837.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信