Firebase的storage.object().onChange现已被弃用。

5
我正在为上传到Firebase数据库后调整图像大小的触发器进行设置,但是我收到了以下消息:错误:“onChange”现已弃用,请使用“onArchive”,“onDelete”,“onFinalize”或“onMetadataUpdate”。在ObjectBuilder.onChange(/ home / kill / trigger/functions/node_modules/firebase-functions/lib/providers/storage.js:88:15)处,我也尝试了: functions.storage.object().onArchive,它在终端上可以工作,但当我在Firebase GUI中检查函数时,会出现错误代码:13,“无法配置触发器..”,有人能帮帮我吗?谢谢大家。
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;
});

2
该消息告诉您onChange已被弃用,您应该使用其他存储触发器类型之一。您可能想要使用onFinalize。请阅读有关存储事件的文档。https://firebase.google.com/docs/functions/gcp-storage-events - Doug Stevenson
1个回答

7

你需要使用 onFinalize() 而不是 onChange()。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接