Function FieldValue.arrayUnion() called with invalid data. FieldValue.serverTimestamp() can only be used with update() and set()
You can't use FieldValue.serverTimestamp()
as the value to union (add) or remove, to or from, an array type value of a document field. If you want to use that timestamp value, you need to pass it directly to a field you're updating or setting. This is true for everything in the FieldValue
class. That class is named this way for a reason - it applies only to field values, not elements of arrays. Note that nested map fields do count as field values. Any involvement of an array in the path is not viable.
You'll have to think of another way you structure your data that meets your needs and also satisfies Firestore requirements.
Use this
let deposit.created_at= firebase.firestore.Timestamp.now();
More information can be found at https://firebase.google.com/docs/reference/js/firebase.firestore.Timestamp#now