I'm working with Cloud Functions and I'm trying to debug why my code isn't creating a row in the users collection (although it is successfully creating the new user via Auth). Below is what the error looks like. I think it has something to do with my timestamp, but I can't even read the full error properly. How can I capture the error and store it into a variable, then output it in one line in the console log?
exports.newUserSignup = functions.auth.user().onCreate(user => {
console.log('user created', user.email, user.uid);
const doc = admin.firestore().collection('users').doc();
return doc.set({
createDate: admin.firestore.Timestamp,
modifiedDate: admin.firestore.Timestamp,
username: 'blah',
email: user.email,
stat: 1,
uid: user.uid,
rowpointer: doc.id,
});
});
I've tried both admin.firestore.Timestamp
and admin.firestore.FieldValue.serverTimestamp
. Both gave errors.
question from:
https://stackoverflow.com/questions/65865997/how-do-i-make-the-console-log-show-the-error-together-instead-of-on-separate-lin 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…