[Python] Incorrect argument error when trying to enqueue a task within a firebase function

Discussão em 'Python' iniciado por Stack, Março 24, 2025.

  1. Stack

    Stack Membro Participativo

    I have a firebase function that attempts to enqueue a task with some data. Every time I call it I get the following two errors from the cloud run logs:


    requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://cloudtasks.googleapis.com/v...s/us-central1/queues/TASK_FUNCTION_NAME/tasks


    firebase_admin.exceptions.InvalidArgumentError: Request contains an invalid argument.
    ​

    Here is my code:

    @scheduler_fn.on_schedule(schedule="every day 00:00", timeout_sec=540, secrets=[APIFY_API_KEY])
    def update_brooklyn_listings(event: scheduler_fn.ScheduledEvent) -> None:
    asyncio.run(update_brooklyn_listings_async())

    async def update_brooklyn_listings_async():
    result = await SOME_ASYNC_TASK
    data = json.loads(result.get_bytes(format="json"))
    body = {"data": data}
    task_queue = functions.task_queue("functionname")
    task_queue.enqueue(body)


    Based on the enqueue documentation no options parameter is needed, and the data passed in can be of type Any. Any idea what I could be missing here?

    Continue reading...

Compartilhe esta Página