【问题标题】:Cloud Function Deployment failure When Using Wildcard in Trigger在触发器中使用通配符时云功能部署失败
【发布时间】:2020-02-07 04:14:56
【问题描述】:

所以,基本上与this SO post 中的问题相同,除了我使用的是 Python 并且接受的答案没有帮助。

在控制台 UI 中使用提供的模板:

def hello_firestore(event, context):
    """Triggered by a change to a Firestore document.
    Args:
         event (dict): Event payload.
         context (google.cloud.functions.Context): Metadata for the event.
    """
    resource_string = context.resource
    # print out the resource string that triggered the function
    print(f"Function triggered by change to: {resource_string}.")
    # now print out the entire event object
    print(str(event))

在触发路径中带有通配符:

'emails/{wildcard}'

我收到以下错误:

部署失败:未能配置触发器 提供者/cloud.firestore/eventTypes/document.create@firestore.googleapis.com (gcf.us-central1.presignups-counter)

与引用的问题类似,从触发器资源中删除通配符时错误会清除:

'emails/wildcard'

编辑:这是功能详细信息的屏幕截图:

【问题讨论】:

  • 请编辑问题以准确显示您在控制台中所做的事情。我们需要能够查看您提供的所有确切值
  • @DougStevenson 截图已添加,如有其他需要请告诉我。

标签: python google-cloud-firestore google-cloud-functions


【解决方案1】:

我能够使用 emails/{wildcard} 而不是 'emails/{wildcard}' 来部署云功能。

原因是当文档路径添加到 UI 中时,它应该没有单引号。当它在代码中时,它应该用单引号引起来。更多信息here

【讨论】:

    猜你喜欢
    • 2020-01-07
    • 2020-10-19
    • 2022-09-01
    • 2019-01-30
    • 2023-04-01
    • 2021-12-31
    • 2020-05-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多