You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Firebase函数入队Cloud Tasks任务时触发参数无效错误的排查求助

Firebase函数入队Cloud Tasks任务时触发参数无效错误的排查求助

我有一个Firebase函数,尝试将带有一些数据的任务加入队列,但每次调用它时,都会在Cloud Run日志中看到以下两个错误:

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://cloudtasks.googleapis.com/v2/projects/PROJECT_ID/locations/us-central1/queues/TASK_FUNCTION_NAME/tasks

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

以下是我的代码:

@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)

根据enqueue的文档,不需要options参数,传入的data可以是Any类型。有没有人知道我可能哪里漏了?

备注:内容来源于stack exchange,提问作者yambo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.13 20:03:03