node.js - 尝试在 Google Cloud Functions 中删除文档时收到内部错误
问题描述
我有一个 cron 调用,它只是像这样删除一个文档:
// expiringBoardPostCronCall
// This function is called to remove all board posts at the nearest expire time
exports.expiringBoardPostCronCall = functions.https.onRequest((request, response) => {
// Get the current date rounded to nearest 15 minutes, divide by 1000 to convert from ms to s
const currentTime = Date.now();
const coeff = 1000 * 60 * 5;
const roundedTime = ((Math.round(currentTime / coeff)) * coeff) / 1000;
// Delete the expiring document
db.collection('expireTimes').doc(roundedTime.toString()).delete().then(snapshot => {
// Do nothing, the expiring document was removed successfully
response.end()
return
}).catch(error => {
console.error("Error removing expireTimes document: ", error);
response.end()
});
})
我最近从函数日志中收到以下错误:
错误:13 内部:收到带有代码 2 的 RST_STREAM
在 Object.callErrorFromStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call.js:30:26)
在 Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client.js:175:52)
在 Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:341:141)
在 Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:304:181)
在 Http2CallStream.outputStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:116:74)
在 Http2CallStream.maybeOutputStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:155:22)
在 Http2CallStream.endCall (/workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:141:18)
在 ClientHttp2Stream.stream.on (/workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:403:22)
在 ClientHttp2Stream.emit (events.js:198:13)
在 ClientHttp2Stream.EventEmitter.emit (domain.js:466:23)
代码:13,
详细信息:'收到带有代码 2 的 RST_STREAM',
元数据:元数据 { internalRepr:地图 {},选项:{} } }
函数执行耗时 21 ms,完成状态码:200
我一直在关注此处和此处列出的 github 线程,但似乎没有一个好的答案。似乎其他人在几乎相同的错误日志中遇到了同样的问题。我在 Node.js 10 中运行。有没有其他人看到这个或有类似的问题?有什么解决办法吗?
解决方案
推荐阅读
- javascript - jquery json显示未定义的html表解析
- google-apps-script - 我想将不同文档中的多个段落放在我文档中的占位符处
- apache-kafka - Spring boot Kafka 请求-回复场景
- nearprotocol - 如何针对具有多个合同的本地网络运行 Near-js-api 测试
- python - 读入并将多个文件合并或合并到公共 ID 列上的一个数据帧中
- .net-core - log4net:错误无法创建类型为 [log4net.Appender.ColoredConsoleAppender] 的 Appender [Console]。报告错误
- python - 将 pandas df 转换为具有不同长度的列表列表
- r - 列出特定观察的变量的特定值
- java - 如何在java中运行x数量的线程并将它们连接在一起?
- c# - 程序生成的球形网格上的 MeshCollider 无法正常工作