Firebase 云功能中的 Firebase 存储错误
Firebase Storage error in Firebase Cloud Function
我在云函数中使用 const bucket = admin.storage().bucket();
,在最上面,我有:
const functions = require('firebase-functions')
const admin = require("firebase-admin");
admin.initializeApp();
当我尝试部署时,出现错误:
i functions: Loaded environment variables from. Error: Missing bucket name. If you are unit testing, please provide a bucket name through functions.storage.bucket(bucketName), or set process.env.FIREBASE_CONFIG.`
我相信这是在我更新后才开始发生的。谢谢你的帮助。
经过更多测试后,我意识到问题不在于 admin.storage().bucket()
,而在于 functions.storage.object().onFinalize(...
而应该是 functions.storage.bucket('{bucketname}').object().onFinalize(...
。
Google 发布了带有错误的新 firebase-tools,刚刚修复了 v9.16.3 中的错误
https://github.com/firebase/firebase-tools/releases/tag/v9.16.3
Release note
我在云函数中使用 const bucket = admin.storage().bucket();
,在最上面,我有:
const functions = require('firebase-functions')
const admin = require("firebase-admin");
admin.initializeApp();
当我尝试部署时,出现错误:
i functions: Loaded environment variables from. Error: Missing bucket name. If you are unit testing, please provide a bucket name through functions.storage.bucket(bucketName), or set process.env.FIREBASE_CONFIG.`
我相信这是在我更新后才开始发生的。谢谢你的帮助。
经过更多测试后,我意识到问题不在于 admin.storage().bucket()
,而在于 functions.storage.object().onFinalize(...
而应该是 functions.storage.bucket('{bucketname}').object().onFinalize(...
。
Google 发布了带有错误的新 firebase-tools,刚刚修复了 v9.16.3 中的错误 https://github.com/firebase/firebase-tools/releases/tag/v9.16.3
Release note