Google Cloud Storage事件触发导致过多的重叠通知



我正在尝试从Cloud Shell部署谷歌云功能,对日志的审查显示以下错误:

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.

当此代码被触发以响应云存储事件(特别是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()

最新更新