在另一个项目中,我几乎具有相同的效果,并且效果很好,但是效果不佳。
有趣的是错误13,说这是一个内部问题,但显然一切都很好
端子:
Failed to configure trigger providers/cloud.firestore/eventTypes/document.create@firestore.googleapis.com (__gcf__.us-central1.noticiasGenerales)
Functions deploy had errors with the following functions:
noticiasGenerales
To try redeploying those functions, run:
firebase deploy --only functions:noticiasGenerales
To continue deploying other features (such as database), run:
firebase deploy --except functions
我的代码:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.noticiasGenerales = functions.firestore
.document('año/{idAño}/colegios/{idColegio}/comunicados/{idComunicado}')
.onCreate(async (snap, context) => {
sendNotificationTopic('001', "Nueva tarea", "Se te ha asignado una nueva tarea")
})
async function sendNotificationTopic(topic, title, body) {
await admin.messaging().sendToTopic(topic, notificacion(title, body))
}
function notificacion(title, body) {
return payload = {
notification: {
title,
body,
icon: "default",
sound: "default"
},
};
}
报告:
{"@type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{"code":13,"message":"INTERNAL"},"authenticationInfo":{"principalEmail":"luismenesesep@gmail.com"},"requestMetadata":{"requestAttributes":{},"destinationAttributes":{}},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.functions.v1.CloudFunctionsService.UpdateFunction","resourceName":"projects/stack-core/locations/us-central1/functions/noticiasGenerales"}