Ale*_*gli 5 node.js firebase google-cloud-functions
我很少在 Firebase Cloud Functions 日志中看到此错误:
“错误:函数终止。建议的操作:检查日志以了解终止原因。其他故障排除文档可在https://cloud.google.com/functions/docs/troubleshooting#logging请求被拒绝。”。
我查看了此错误发生前后的日志,没有看到任何其他信息,只是同一云函数的其他一些成功执行。同一函数每天成功执行数千次,但随后每天或几个小时就会显示一次。我的整个云函数体都包含在 try/catch 中,并且我已经看到从 catch 代码中的错误日志正确报告了逻辑错误,因此我不知道这个未捕获的错误是如何发生的,也不知道如何获取有关它的更多信息。有谁知道这个错误是如何发生的?这是该函数的清理版本,抛出了这个奇怪的错误:
exports.onUserDocUpdate = functions.firestore
.document('user/{userId}/{collectionId}/{docId}')
.onWrite(handleDocumentWrite);
async function handleDocumentWrite(change, context) {
try {
// Function logic here
} catch (error) {
functions.logger.error(`firestoreTriggers.handleDocumentWrite failed with error:`, error);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
611 次 |
| 最近记录: |