Salut, am o functie addWelcomeMessages care ar trebui sa afiseze o notificare cand un user nou isi face cont in aplicatie.
Modulul arata cam asa:
const functions = require('firebase-functions');
// Import and initialize the Firebase Admin SDK.
const admin = require('firebase-admin');
admin.initializeApp();
// Adds a message that welcomes new users into the chat.
exports.addWelcomeMessages = functions.auth.user().onCreate(async (user) => {
console.log('A new user signed in for the first time.');
const fullName = user.displayName || 'Anonymous';
// Saves the new welcome message into the database
// which then displays it in the FriendlyChat clients.
await admin.firestore().collection('messages').add({
name: 'Firebase Bot',
profilePicUrl: '/images/firebase-logo.png', // Firebase logo
text: `${fullName} signed in for the first time! Welcome!`,
timestamp: admin.firestore.FieldValue.serverTimestamp(),
});
console.log('Welcome message written to database.');
});
Problema este ca nu imi arata notificarea. In consola din browser nu primesc nicio eroare. In logurile din Firebase functions am eroarea asta:
Aveti idee de la ce poate fi?
Later edit: am versiunea de Node 12.18.4
Pace