Rohin
Rohin

Reputation: 380

Firebase Storage error in Firebase Cloud Function

I use const bucket = admin.storage().bucket(); in the cloud function, and at the very top, I have:

const functions = require('firebase-functions')
const admin = require("firebase-admin");
admin.initializeApp();

When I try to deploy, it gives me an error:

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.`

This only started happening after I updated, I believe. Thank you for your help.

Upvotes: 3

Views: 705

Answers (2)

laeyoung
laeyoung

Reputation: 68

Google released new firebase-tools with a bug, just fixed the bug at v9.16.3 https://github.com/firebase/firebase-tools/releases/tag/v9.16.3

Release note

Upvotes: 5

Rohin
Rohin

Reputation: 380

After some more testing, I realized that the issue was not with admin.storage().bucket(), it was with functions.storage.object().onFinalize(... which should be functions.storage.bucket('{bucketname}').object().onFinalize(... instead.

Upvotes: 0

Related Questions