firebase / firebase-admin-node

Firebase Admin Node.js SDK

Home Page:https://firebase.google.com/docs/admin/setup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid bucket name `buckets/myapp.appspot.com` - nondeterministic error

ben519 opened this issue · comments

commented

Step 2: Describe your environment

  • Operating System version: mac os 13.5.2
  • Firebase SDK version: firebase-admin 11.11.0
  • Firebase Product: admin
  • Node.js version: v18.18.0
  • NPM version: 10.1.0

Step 3: Describe the problem

Today I started experiencing a nondeterministic bug whereby when I try to start firebase functions in my local emulator, sometimes it works and sometimes it gives me the error

Got response code 400; body Failed to generate manifest from function source: Error: Invalid bucket name buckets/myapp-dev.appspot.com

If I run firebase functions:shell --debug five times in a row, it may work once or twice and fail the rest of the time.

In the failure case, it looks like the following GET request is pulling my bucket name with the buckets/ prefix

[apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/myapp-dev/adminSdkConfig {"projectId":"myapp-dev","storageBucket":"buckets/myapp-dev.appspot.com","locationId":"us-central"}

In the non-failure case, the same GET request is pulling my bucket name without the buckets/ prefix.

[apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/myapp-dev/adminSdkConfig {"projectId":"myapp-dev","storageBucket":"myapp-dev.appspot.com","locationId":"us-central"}

Proof
nondeterministic bug

Steps to reproduce:

My index.js file looks more or less like this

import { initializeApp } from "firebase-admin/app"
import { getFirestore } from "firebase-admin/firestore"
import { getStorage } from "firebase-admin/storage"
import { setGlobalOptions } from "firebase-functions/v2"

// Initialize app
const app = initializeApp()
setGlobalOptions({ region: "us-central1" })

export const db = getFirestore(app)
export const storage = getStorage(app)

// ... my firebase functions here

Then I run firebase functions:shell --debug to trigger the error.

Important note: I recently noticed in my firebase console that my bucket name is listed as buckets/myapp-dev.appspot.com. I could be wrong, but I thought that it didn't used to have that buckets/ prefix.

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

Hi @ben519, Thank you for reporting this issue. We are aware of an incident in the Storage API that might have caused this. The issue should be resolved by now. Please let us know if you still have trouble with the API. We are sorry for the frustration this may have caused and thank you for your patience!