我的云功能不断产生此错误。
failed with error: ("Failed to retrieve http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/{service-account}/token from the Google Compute Enginemetadata service. Status: 500 Response:\nb'Could not fetch URI /computeMetadata/v1/instance/service-accounts/{service-account}/token\\n'", <google.auth.transport.requests._Response object at 0x2a6b7bacebe0>)
我创建了一个需要与Firebase Firestore连接的云功能。我还创建了一个与“编辑者”角色绑定的服务帐户。我不知道为什么它仍然无法工作。
我的源代码。
import base64
import firebase_admin
import requests
from firebase_admin import firestore
def api(request):
# Get client id and client token from header?
request_json = request.get_json() # Get data
firebase_admin.initialize_app()
db = firestore.client()
return "Successful"