I'm trying to debug some weird issues with my Firebase Cloud Functions setup used together with Cloud Firestore. I'm writing some data to Cloud Firestore and have some triggers built in Cloud Functions. When I look at the logs it seems like sometimes onCreate trigger runs after onUpdate trigger.
From documentation I read "As with all background functions, event ordering is not guaranteed."
So from my understanding this can actually happen? I just want to make sure as this would change a lot in my setup.
For example if I need to update some other document when a document is updated or created, how can I make sure I write the latest data if the updates doesn't run in the correct order. I usually use the data from change.after.data() but the only other solution I could see would be to read the data everytime to make sure to have the latest.
So two questions:
- Can I trust that my triggers happens in the same order?
- If not how do I solve this issue?
Thanks for explaining and helping!