Storage `bucket.exists()` always returns false for firebase emulator
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- node.js, typescript
调研方向
首先,使用报告中的 firebase-admin@12.0.0 和 firebase-tools@13.1.0 设置,通过 firebase emulators:start --only storage,functions 重现该问题。使用默认 bucket 名称跟踪 getStorage().bucket() 和 bucket.exists(),然后将 emulator 的请求和响应与预期的 bucket 状态进行比较。当 bucket.exists() 针对匹配的默认 emulator bucket 返回 true 时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
[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)
- 主要语言
- TypeScript
- 星标
- 1.7k
- 派生
- 419
- 平均合并
- 4 天 20 小时
- 30 天内合并 PR
- 16
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
firebase/firebase-admin-node 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
firebase/firebase-admin-node#3234 ·
-
firebase/firebase-admin-node#3221 · 3 条评论 · 已指派 1 人 ·
-
api: messaging
难度 3/5 1-2 天 新手友好度 70/100
firebase/firebase-admin-node#3215 ·
-
api: messaging
难度 5/5 一周以上 新手友好度 28/100
firebase/firebase-admin-node#3214 ·
-
api: firestore type: feature request
firebase/firebase-admin-node#3183 · 1 条评论 · 已指派 1 人 ·
查看 firebase/firebase-admin-node 的全部 Issue
相似的 Issue
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
-
Crush 未关闭
难度 1/5 1 小时以内 新手友好度 85/100
catppuccin/catppuccin#3125 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
ElementsProject/cln-application#167 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 75/100
Quantco/pnpm-licenses#17 ·
-
难度 2/5 1-3 小时 新手友好度 75/100