I have a firestore collection called Posts I make an insert on the client side and it works.
I want to add the createdAt and updatedAt fields to every insert in my p
You do not need Cloud Functions to do that. It is much simpler (and cheaper) to set server timestamp in client code as follows:
var timestamp = firebase.firestore.FieldValue.serverTimestamp() post.createdAt = timestamp post.updatedAt = timestamp