当我在一个firebase可调用函数中这样做时:
for (const origin of originList) {
for (const destiny of destinyList) {
// mount the url
const respPromise = fetch(url)
.then((resp) => resp.json())
.then((data) => {
// manipulate a big JSON (2000 lines or more each one)
})
fetchPromises.push(respPromise)
}
}
await Promise.all(fetchPromises)
字符串
两个列表都可以有10个以上的寄存器,所以fetch将运行数百次。它非常不稳定,有时我会得到正确的结果,但大多数时候我会得到:
Unhandled error TypeError: fetch failed
...
cause: Error: redirect count exceeded
at makeNetworkError (node:internal/deps/undici/undici:4801:35)
at httpRedirectFetch (node:internal/deps/undici/undici:9659:16)
at httpFetch (node:internal/deps/undici/undici:9632:28)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async schemeFetch (node:internal/deps/undici/undici:9535:18)
at async node:internal/deps/undici/undici:9409:20
at async mainFetch (node:internal/deps/undici/undici:9399:20)
at async httpFetch (node:internal/deps/undici/undici:9632:22)
at async schemeFetch (node:internal/deps/undici/undici:9535:18)
at async node:internal/deps/undici/undici:9409:20
型
我不知道这是否是一个纯JavaScript代码,我可以找到,但重构代码或firebase不能调用这么多的可调用函数内的获取。
有什么建议吗?
1条答案
按热度按时间vktxenjb1#
问题是我的代码调用了Firebase函数。
我在前端的
handleSubmit()
函数中示例化Firebase可调用函数。当我把它转移到外面,错误已经弯腰:
字符串