You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const previousData = change.before.data(); I can't retrieve the previous document.
The 'previousData' log value is undefined.
How can I get document data?
The onWrite trigger is invoked for all changes to a document; if you are creating a new document, then there will be no data in the before property.
However I would first recommend that you try out 2nd gen Firestore triggers! You can find the docs here; the 2nd gen triggers have a slightly different interface, but the logic is similar.
I'm going to close this since GitHub issues are reserved for reporting bugs, but you can reach out to Firebase Support here if you continue to have trouble writing Firestore functions.
The onWrite trigger is invoked for all changes to a document; if you are creating a new document, then there will be no data in the before property.
However I would first recommend that you try out 2nd gen Firestore triggers! You can find the docs here; the 2nd gen triggers have a slightly different interface, but the logic is similar.
I'm going to close this since GitHub issues are reserved for reporting bugs, but you can reach out to Firebase Support here if you continue to have trouble writing Firestore functions.
const previousData = change.before.data(); I can't retrieve the previous document.
The 'previousData' log value is undefined.
How can I get document data?
"firebase": "^8.6.8",
"firebase-admin": "^11.10.1",
"firebase-functions": "^4.4.1",
Node.js v18.13.0
The text was updated successfully, but these errors were encountered: