Google Cloud Storage 事件触发器导致太多重叠通知
Google Cloud Storage event trigger causes Too many overlapping notifications
我正在尝试从云 Shell 部署 Google 云功能,查看日志显示以下错误:
google.api_core.exceptions.BadRequest: 400 POST
https://storage.googleapis.com/storage/v1/b/my-bucket/notificationConfigs?
prettyPrint=false: Too many overlapping notifications. The maximum is 10.
当为响应 Cloud Storage 事件(特别是 Finalize/Create 新对象)而触发此代码时会引发错误。
def notifier(event, context):
print("""This Function was triggered by messageId {} published at {} to {}
""".format(context.event_id, context.timestamp, context.resource["name"]))
if 'data' in event:
name = base64.b64decode(event['data']).decode('utf-8')
else:
name = 'World'
print('Hello {}!'.format(name))
storage_client = storage.Client()
bucket = storage_client.bucket("my-bucket")
notification = bucket.notification(topic_name="my-bucket-upload")
notification.create()
print(f"Successfully created notification with ID {notification.notification_id} for {bucket_name}")
我找不到与此错误相关的任何参考信息,我不知道下一步该怎么做。什么可能导致此错误消息?
修补程序:
从该代码中删除 notification.create()
。
我正在尝试从云 Shell 部署 Google 云功能,查看日志显示以下错误:
google.api_core.exceptions.BadRequest: 400 POST
https://storage.googleapis.com/storage/v1/b/my-bucket/notificationConfigs?
prettyPrint=false: Too many overlapping notifications. The maximum is 10.
当为响应 Cloud Storage 事件(特别是 Finalize/Create 新对象)而触发此代码时会引发错误。
def notifier(event, context):
print("""This Function was triggered by messageId {} published at {} to {}
""".format(context.event_id, context.timestamp, context.resource["name"]))
if 'data' in event:
name = base64.b64decode(event['data']).decode('utf-8')
else:
name = 'World'
print('Hello {}!'.format(name))
storage_client = storage.Client()
bucket = storage_client.bucket("my-bucket")
notification = bucket.notification(topic_name="my-bucket-upload")
notification.create()
print(f"Successfully created notification with ID {notification.notification_id} for {bucket_name}")
我找不到与此错误相关的任何参考信息,我不知道下一步该怎么做。什么可能导致此错误消息?
修补程序:
从该代码中删除 notification.create()
。