This firebase function which triggers firebase messaging fails due to unknown error
import * as functions from "firebase-functions";
import * as admin from "firebase-admin";
const messaging = admin.messaging();
export const sendChatNotification = functions.firestore.document('chats/{chatId}/messages/{messageId}').onCreate(async (snapshot) => {
const message = {
notification: {
title: `Message from test`,
body: `You have a new message from test`
},
topic: 'ueyANM8p3kSGaeVpVBcVw6cCzYK2',
data: {
chatId: snapshot.id,
},
};
return messaging.send(message)
}
error i get -
[debug] [2023-01-15T21:09:02.049Z] Error: Failed to update function sendChatNotification in region us-central1
at /opt/homebrew/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:41:11
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Fabricator.updateV1Function (/opt/homebrew/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:305:32)
at async Fabricator.updateEndpoint (/opt/homebrew/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:140:13)
at async handle (/opt/homebrew/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:78:17)
[error]
[error] Error: There was an error deploying functions
Firebase tools version - 11.13.0, updated to 11.14.0 but still same error