【发布时间】:2020-10-19 07:51:57
【问题描述】:
我正在尝试使用 Cloud Firestore 作为触发器来部署我的 Cloud Function。 Cloud 函数只是侦听我的 firestore 路径上的任何新文档创建,并将新数据记录到控制台。但是,功能部署失败,并且没有明确的错误消息。您能帮我确定可能是什么问题吗?
云功能码:
const functions = require('firebase-functions');
exports.createUser = functions.firestore
.document('test_restaurant/{id}/reviews/{id}')
.onCreate((snap, context) => {
console.log(snap.data());
});
错误日志:
2020-06-28 18:51:03.110 IST
Cloud Functions
UpdateFunction
asia-east2:function-test-2
abc@gmail.com
Function failed on loading user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs
Expand all | Collapse all
{
insertId: "5u231ccch0"
logName: "projects/fs-22/logs/cloudaudit.googleapis.com%2Factivity"
operation: {
id: "operations/ZmlyZXN0b3JlLTI0OTcwNS9hc2lhLWVhc3QyL2Z1bmN0aW9uLXRlc3QtMi9xOVJCbHpESzdjSQ"
last: true
producer: "cloudfunctions.googleapis.com"
}
protoPayload: {
@type: "type.googleapis.com/google.cloud.audit.AuditLog"
authenticationInfo: {
principalEmail: "abc@gmail.com"
}
methodName: "google.cloud.functions.v1.CloudFunctionsService.UpdateFunction"
resourceName: "projects/fs-22/locations/asia-east2/functions/function-test-2"
serviceName: "cloudfunctions.googleapis.com"
status: {
code: 3
message: "Function failed on loading user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs"
}
}
receiveTimestamp: "2020-06-28T13:21:03.364975479Z"
resource: {
labels: {
function_name: "function-test-2"
project_id: "fs-22"
region: "asia-east2"
}
type: "cloud_function"
}
severity: "ERROR"
timestamp: "2020-06-28T13:21:03.110Z"
}
【问题讨论】:
-
错误输出为您提供了检查日志的链接。你试过了吗?
-
是的,日志没有给出任何具体错误。 @道格史蒂文森
标签: javascript google-cloud-firestore google-cloud-functions