最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - GCS function: missing 1 required positional argument: 'context' - Stack Overflow

programmeradmin0浏览0评论

I have a large GCS function that used to work, and after updating it to include a minor change I am getting the following error:

TypeError: gcs_trigger() missing 1 required positional argument: 'context'

For context, my entry function does have context:

def gcs_trigger(event, context):
    """Handles a GCS event, processes zip files for nominal and backup procedures"""

    bucket_name = event["bucket"]
    file_path = event["name"]

    # Initialize the storage client
    storage_client = storage.Client()
    bucket = storage_client.bucket(bucket_name)

    # NOMINAL PROCEDURE
    if (
        file_path.endswith(".zip")
        and file_path.startswith(SPECIFIC_FOLDER)
        and file_path.count("/") == NOMINAL_PROCEDURE_SLASH_COUNT
    ):
    ....

Reading about it, I have seen it can be caused if the function is triggered by an HTTP request, but it is not my case.

Running gcloud functions describe gives me:

eventTrigger:
  eventFilters:
  - attribute: bucket
    value: mybucket
  eventType: google.cloud.storage.object.v1.finalized

What am I missing?

发布评论

评论列表(0)

  1. 暂无评论