Storage `bucket.exists()` always returns false for firebase emulator
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- node.js, typescript
Research direction
Start by reproducing the issue with firebase emulators:start --only storage,functions using the reported firebase-admin@12.0.0 and firebase-tools@13.1.0 setup. Trace getStorage().bucket() and bucket.exists() with the default bucket name, then compare the emulator request and response with the expected bucket state. Done means bucket.exists() returns true for the matching default emulator bucket.
Written by the indexing model from the issue text.
Description
[READ] Step 1: Are you in the right place?
- For issues related to the code in this repository file a Github issue.
- If the issue pertains to Cloud Firestore, read the instructions in the "Firestore issue"
template. - For general technical questions, post a question on StackOverflow
with the firebase tag. - For general Firebase discussion, use the firebase-talk
google group. - For help troubleshooting your application that does not fall under one
of the above categories, reach out to the personalized
Firebase support channel.
[REQUIRED] Step 2: Describe your environment
- Operating System version: Ubuntu
- Firebase SDK version: firebase-admin@12.0.0 firebase-tools@13.1.0
- Firebase Product: storage
- Node.js version: 18.16.1
- NPM version: 9.5.1
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
Create basic project with storage and functions setup for emulation: (functions only used to call storage bucket methods)
// firebase.json
"emulators": {
"functions": {
"port": 5001
},
"storage": {
"port": 9199
},
// ...rest of config
Run emulator with firebase emulators:start --only storage,functions
Verify storage bucket exists in emulator and the name is matched in firebase config showing storage_bucket as the default
Hit the firebase function to run the storage bucket code
Calling bucket.exists() from firebase function always returns false.
Expected outcome:
Calling bucket.exists() from firebase function return true when accessing the default bucket.
Relevant Code:
import { onRequest } from 'firebase-functions/v2/https';
import { getStorage } from 'firebase-admin/storage';
export const foo = onRequest(async (req, res) => {
const storage = getStorage();
console.log('APP STORAGE BUCKET:', storage.app.options.storageBucket);
const bucket = storage.bucket();
console.log('DEFAULT STORAGE BUCKET:', `name=${bucket.name}`, `id=${bucket.id}`);
const exists = await bucket.exists();
console.log('BUCKET EXISTS?:', exists);
res.send(`BUCKET EXISTS?: ${exists}`);
});
Images
Console output:
Emulator Storage: (name of bucket matches id in code)
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 419
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 16
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from firebase/firebase-admin-node
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
firebase/firebase-admin-node#3234 ·
-
firebase/firebase-admin-node#3221 · 3 comments · 1 assignee ·
-
api: messaging
Difficulty 3/5 1-2 days Newbie friendliness 70/100
firebase/firebase-admin-node#3215 ·
-
api: messaging
Difficulty 5/5 Over a week Newbie friendliness 28/100
firebase/firebase-admin-node#3214 ·
-
api: firestore type: feature request
firebase/firebase-admin-node#3183 · 1 comment · 1 assignee ·
All issues in firebase/firebase-admin-node
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
mksglu/context-mode#1200 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anthropics/claude-code#96687 ·
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
AOSSIE-Org/DebateAI#582 · 2 comments ·