Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase storage.object().onChange is now deprecated,

Im doing a trigger to resize image after upload to firebase database but I got this message: Error: "onChange" is now deprecated, please use "onArchive", "onDelete", "onFinalize", or "onMetadataUpdate". at ObjectBuilder.onChange (/home/kill/trigger/functions/node_modules/firebase-functions/lib/providers/storage.js:88:15), I aslso tried : functions.storage.object().onArchive, it`s works on terminal but when i check in the function on firebase GUI, there is a error code:13, "failed to configure trigger..", someone could help me? Appreciate guys

const functions = require('firebase-functions');

// // Create and Deploy Your First Cloud Functions
 // // https://firebase.google.com/docs/functions/write-firebase-functions

exports.onFileChange = functions.storage.object().onChange(event => {
    console.log(event);
    return;
});
like image 552
Jader Costa Avatar asked Sep 02 '18 15:09

Jader Costa


1 Answers

You have to use onFinalize() instead of onChange()

like image 140
Toufiq Avatar answered Oct 20 '22 12:10

Toufiq