Currently, I am faced with an issue in my Cloud Functions setup. Despite successfully creating a new user through Auth, my code is failing to generate a new row in the users collection. The error message below hints at a problem related to timestamps, although I am unable to decipher the entire error. How can I effectively capture this error, store it in a variable, and then output it in a single line within the console log?
https://i.sstatic.net/hNwGE.png
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 experimented with both admin.firestore.Timestamp
and
admin.firestore.FieldValue.serverTimestamp
, only to encounter errors in both cases.