I'm trying to use a daily trigger to alter information in my Firebase database. I have a number of other cloud functions that work properly, but I can't seem to get this function to alter the database.
const admin = require('firebase-admin');
exports.daily_job = functions.pubsub.topic('daily-tick').onPublish((event) => {
console.log("This job is run every day!");
const databaseRef = admin.database().ref('/accountActions/dailyDeletion');
databaseRef.child('delete').set("Data has been deleted!");
return "End of database clearing";
});
This is the code I've been testing to see if the trigger is working. In my console it's showing that the function starts, the console statement is logged, and execution finishes in 40-90ms. But my database is never changed. The deletion statement never appears.
Any help is greatly appreciated!