I have this node js function that attempts to update Algolia index once a add/update/delete is done to node Listings
exports.indexlisting_algolia =
function
You're using an old version of the API exposed by the firebase-functions module. The new one requires that you accept a Change object, with before
and after
attributes, as the first parameter of onWrite and onUpdate triggers. Those attributes will be DataSnapshot objets. Your code is currently expecting a DataDeltaSnapshot, which is what you got in the beta version before the full 1.0 release. This is now deprecated.
You can read about the API changes in version 1.0 in the documentation.
Please also see the documentation for database triggers for examples.
Your function should look more like this:
exports.indexlisting_algolia =
functions.database.ref('/Listings/{listingId}')
.onWrite((change, context) => {
const before = change.before; // snapshot before the update
const after = change.after; // snapshot after the update
const before_data = before.val();
const afater_data = after.val();
})