【问题标题】:Error: quota exceeded (Quota exceeded for quota group 'DNSResolutionsNonbillable' and limit 'DNS resolutions per day'错误:超出配额(配额组“DNSResolutionsNonbillable”超出配额并限制“每天的 DNS 解析”
【发布时间】:2020-08-20 09:23:27
【问题描述】:

我正在测试一个后台函数,该函数计算在特定字段中创建的文档数,但出现此错误。

我知道我每月有 200 万次调用(包括项目的后台和 HTTP 调用,因为 this 而我只有 24k。我使用事务是因为我正在使用事务测试结果的可靠性和from google.cloud.firestore_v1 import Increment

根据少量数据,我使用增量方法得到了错误的计数。例如,从 15 个项目中,该函数得到 14 个,并且对于 500 个,该函数计数我少了一个,但数据更多,我得到了最差的结果(更大的差异),所以我希望这不会发生在事务中。但是,现在我无法测试此错误,它怎么会发生?感谢您的时间。 这是错误:

Error: quota exceeded (Quota exceeded for quota group 'DNSResolutionsNonbillable' and limit 'DNS resolutions per day' of service 'cloudfunctions.googleapis.com' for consumer 'project_number:xxxx'.); to increase quotas, enable billing in your project at https://console.cloud.google.com/billing?project=xxxxx. Function cannot be executed.

这是删除文档时仅减少一个数字的功能:

def increase_total_documents(data,context):
    """ Triggered by a creation to a Firestore document.
        Args:
            data (dict): The event payload.
            context (google.cloud.functions.Context): Metadata for the event.
        """
    trigger_resource = context.resource
    print('Function triggered by change to: %s' % trigger_resource)
    value = data["value"]
    field = value["fields"]["FIELD"]["stringValue"]
    if field == "xfield":
        doc_ref = FIRESTORE_CLIENT.document('metadata/path')
        result = doc_ref.set({"count":Increment(1)},merge=True)
        number = result.transform_results[0].integer_value
        mensaje = "Number increased {}".format(number)
        print(mensaje)
        return mensaje

【问题讨论】:

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


    【解决方案1】:

    除了调用限制之外,Cloud Functions 还限制了在未启用计费时它将解析的外部地址的数量。就像错误消息告诉您的那样,您需要在项目中启用计费以提高配额。

    【讨论】:

    • 谢谢达斯汀,外部地址是什么意思?我的意思是我不知道在哪里可以阅读有关不超过配额的限制
    • 您的函数正在做的事情(很难说,因为您没有共享源代码)导致它通过 DNS 将外部域名解析为 IP 地址,例如example.com -> 93.184.216.34.
    猜你喜欢
    • 2019-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多