Node.js 尝试在Google Cloud函数中删除文档时收到内部错误
我有一个cron调用,它只是删除一个文档,如下所示:Node.js 尝试在Google Cloud函数中删除文档时收到内部错误,node.js,firebase,google-cloud-firestore,google-cloud-functions,Node.js,Firebase,Google Cloud Firestore,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 dat
// 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_流
在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)
在clienthttpp2stream.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_流”
元数据:元数据{internalRepr:Map{},选项:{}
函数执行耗时21毫秒,完成状态代码:200
我一直在关注列出的github线程,但似乎没有一个好的答案。似乎其他人也有同样的问题,错误日志几乎完全相同。我正在Node.js 10中运行。有没有其他人看到这一点或有类似的问题?有什么解决方案吗?您使用最新版本的依赖项吗?嗨@SanzioAngeli这确实很奇怪。然而,由于Node.js API似乎存在问题,我认为最好是遵循Github上的线程,因为开发人员直接支持该API。@guillaumeblaquiere我已经有两周没有检查过了,所以我会再看一看,然后再与您联系。@gso_gabriel感谢您的建议。我将继续关注github线程,但我想看看是否有人知道答案here@guillaumeblaquiere只需要更新firebase管理依赖项。firebase功能是最新的。如果我再次遇到问题,我会重新部署并让所有人知道。同样值得注意的是,这是一个孤立的问题,我只观察过一次。你使用最新版本的依赖项吗?嗨@SanzioAngeli,这确实很奇怪。然而,由于Node.js API似乎存在问题,我认为最好是遵循Github上的线程,因为开发人员直接支持该API。@guillaumeblaquiere我已经有两周没有检查过了,所以我会再看一看,然后再与您联系。@gso_gabriel感谢您的建议。我将继续关注github线程,但我想看看是否有人知道答案here@guillaumeblaquiere只需要更新firebase管理依赖项。firebase功能是最新的。如果我再次遇到问题,我会重新部署并让所有人知道。同样值得注意的是,这是一个孤立的问题,我只观察过一次。