【发布时间】:2021-03-04 08:37:25
【问题描述】:
我已将以下代码放入 Python 3.8 Google Cloud Function 中。我所做的只是更新“Hello-World”示例并在顶部添加导入行。我很困惑,因为我这周刚开始使用 GCP,我认为在存储桶中建立连接会更容易。我在日志中看到的错误位于代码下方。
from google.cloud import storage
def hello_world(request):
"""Responds to any HTTP request.
Args:
request (flask.Request): HTTP request object.
Returns:
The response text or any set of values that can be turned into a
Response object using
`make_response <http://flask.pocoo.org/docs/1.0/api/#flask.Flask.make_response>`.
"""
request_json = request.get_json()
if request.args and 'message' in request.args:
return request.args.get('message')
elif request_json and 'message' in request_json:
return request_json['message']
else:
return f'Hello World!'
错误信息是:
2020-11-20 15:22:20.289 MSTCloud FunctionsUpdateFunctionus-central1:faautoingestiongcp*******@gmail.com {@type: type.googleapis.com/google.cloud.audit.AuditLog, authenticationInfo: {…}, methodName: google.cloud.functions.v1.CloudFunctionsService.UpdateFunction, resourceName: projects/reference-rain-293921/locations/us-central1/functions/faautoingestiongcp, serviceName: cloudfunctions.googleapis.com, s…
{@type: type.googleapis.com/google.cloud.audit.AuditLog, authenticationInfo: {…}, methodName: google.cloud.functions.v1.CloudFunctionsService.UpdateFunction, resourceName: projects/reference-rain-293921/locations/us-central1/functions/faautoingestiongcp, serviceName: cloudfunctions.googleapis.com, s…
【问题讨论】:
-
如何部署功能?
标签: python-3.x google-cloud-platform google-cloud-functions google-cloud-storage