I'm following the video of Doug on youtube to change a message with functions, I'm doing it in javascript, I have installed flow lenguage script since I had an error about 'types' can only be applied to ts files
, now, that error is gone, but when I try to deploy my function I get this error message.
This is my code
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.createdMessage = functions.database.ref('/users/messages/{messageId}').onCreate((snapshot,context)=>{
const messageID = context.params.messageId;
console.log('Message ${messageID}');
const messageData = snapshot.val();
const message = placeEmoticon(messageData.message);
return snapshot.ref.update({message:message});
});
function placeEmoticon(message : string): string {
return message.replace(/\bcar\b/g,'');
}