首页 > 解决方案 > 带有查询参数的 Firebase 函数 GET 请求返回 400 错误

问题描述

当我base通过邮递员执行 GET 到:http://localhost:5001/api-name/region/base.

但是当我在 URL 中添加 get 参数时,请求失败,即http://localhost:5001/api-name/region/base?origin=localhost. 我收到 400 错误请求错误。有趣的是,当邮递员几乎立即报告 400 Bad Request 时,firebase 模拟器的行为就像它仍在运行该功能并在 60 秒后超时。

我有函数运行时选项可以将请求设置为 300 秒(因为这是一个很大的查询并且需要一段时间,所以在没有参数的情况下也可以按预期工作),所以看起来它甚至没有被路由到正确的函数或任何地方。

标签: javascriptfirebasegoogle-cloud-functions

解决方案


我遇到过同样的问题。解决方案是更新到最新版本的 firebase-tools。

如果使用 npm: npm install -g firebase-tools@latest

这是 v9.2.1 中修复的错误。更多信息在这里:https ://github.com/firebase/firebase-tools/releases/tag/v9.2.1


推荐阅读