admin.storage()在Firebase功能中不起作用

时间:2018-08-13 14:43:01

标签: firebase google-cloud-functions firebase-storage firebase-admin

当我尝试通过firebase函数中的admin SDK访问firebase存储时,它在admin.storage()上失败,但是在admin.database()上成功,有什么建议吗?

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

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

const serviceAccount = require("./myapp-ea8ed-firebase-adminsdk-140ib-682f0b6fce.json");    

admin.initializeApp({
       credential: admin.credential.cert(serviceAccount),
       databaseURL: "https://myapp-ea8ed.firebaseio.com"
});

在功能中,我可以通过

访问firebase数据库
const ref = admin.database().ref("/root");

但无法通过

访问Firebase存储
const bucket = admin.storage().bucket("myapp-ea8ed.appspot.com");

0 个答案:

没有答案