gpt4 book ai didi

firebase - Firestore HTTP 失眠查询 : Stream error in the HTTP/2 framing layer

转载 作者:行者123 更新时间:2023-12-04 12:02:41 26 4
gpt4 key购买 nike

我正在尝试通过 Insomnia API 使用 HTTP 查询来查询我的 Firestore 数据库:https://firestore.googleapis.com/v1/projects/typebot/databases/(default)/documents/users用这个 body :

{
"structuredQuery": {
"from": [
{
"collectionId": "users"
}
],
"where": {
"fieldFilter": {
"field": {
"fieldPath": "email"
},
"op": "EQUAL",
"value": {
"stringValue": "email@test.com"
}
}
}
}
}
我收到以下错误:

HTTP query: Stream error in the HTTP/2 framing layer


知道出了什么问题吗?

最佳答案

我在执行 GET 时遇到了类似的问题要求:

GET https://us-central1-my-project-id.cloudfunctions.net/getUsers HTTP/1.1
content-type: application/json
{
"minAge": "18"
}
针对此 Firestore HTTP 云函数定义的端点:
exports.getUsers = functions.https.onRequest(async (req, res) => {
// find matching users by age limit.
const ageLimit = req.body.age;
...

});
事实证明,基于 this other SO post , 一个带有 GET 的请求体从 HTTP 规范建议“在处理请求时应该忽略消息体”(大概是由服务器,并且 Firestore 服务器实现此行为)的意义上说,没有任何意义。奇怪的是,我没有发现使用 Functions 模拟器在本地运行完全相同的函数的这个问题,所以很可能本地服务器忽略了这个建议。
为了解决这个问题,我改变了我的函数来解析查询参数而不是请求正文:
exports.getUsers = functions.https.onRequest(async (req, res) => {
// find matching users by age limit.
const ageLimit = req.query.age; // extract the age as a query param
...

});
和请求:
GET https://us-central1-my-project-id.cloudfunctions.net/getUsers?age=18

关于firebase - Firestore HTTP 失眠查询 : Stream error in the HTTP/2 framing layer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62634688/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com