recording in firebase using firebase cloud Function

Asked

Viewed 32 times

0

Good afternoon Developers community.... difficulty recording using firebase...

firebase cloud functions console gives this error message:

decode64(userTo) ********@gmail.com
decode64(userFrom) YWRyaWVsQHVuaXBsYWNsYWdlcy5lZHUuYnI=
Uncaught exception
ReferenceError: ut is not defined

my code is like this:

let ut = decode64(userTo)
let uf = encode64(userFrom)
console.log('decode64(userTo)', ut)
console.log('encode64(userFrom)', uf)


db.collection('users').doc(ut).collection('contacts').doc(uf).set({
lastMessage: messageDoc.content,
lastMessageTime: new Date()
}, {
    merge: true 
}).then(() => {
    console.log('[END]');
    resolve(true);
    return true;
}).catch(e => {
    throw new Error("User last message not saved.");
});

thank you in advance...

1 answer

1

it started working when I added the following lines >

            let ut = decode64(userTo)
            let uf = encode64(userFrom)
            console.log('decode64(userTo)', ut)
            console.log('encode64(userFrom)', uf)

            console.log('db.collection -> ', db.collection('users')) //essas 3 linhas
            console.log('db.collection.ut -> ', db.collection('users').doc(ut))
            console.log("db.collection('users').doc(ut).collection('contacts')",db.collection('users').doc(ut).collection('contacts'))

            db.collection('users').doc(ut).collection('contacts').doc(uf).set({
                lastMessage: messageDoc.content,
                lastMessageTime: new Date()
            }, {

It just started working !!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.