Firebase Admin SDK: getDownloadUrl - Permission denied. No READ permission
@maneesht 已经在做这个了。
开始于 2023年10月19日。
评估
这个 Issue 还没有评估数据。
描述
Describe your environment
- Operating System version: OSX (and in the cloud environment)
- Firebase SDK version: ^11.11.0 <= firebase-admin
- Firebase Product: firebase-admin / google-storage / firebase-admin/storage
- Node.js version: 16.16.0
- NPM version: 8.11.0
Describe the problem:
I have now tried for a very long time to follow these docs in order to get getDownloadURL to work. https://firebase.google.com/docs/storage/admin/start#use_a_default_bucket
https://firebase.google.com/docs/storage/admin/start#shareable_urls
Regardless of how I initialize my app, when trying to use getDownloadURL I get Error: Permission denied. No READ permission.
Here is how different ways I tried initializing:
initializeApp({
credential: applicationDefault(),
storageBucket: "my-bucket.appspot.com",
});
initializeApp();
initializeApp({
credential: cert(serviceAcount), // loaded from .json file (directly downloaded from firebase console)
storageBucket: "my-bucket.appspot.com",
});
initializeApp({
credential: cert({
projectId: "my-project-id",
privateKey: "my-private-key",
clientEmail: "my-client-email"
}), // grabbed from .json file (directly downloaded from firebase console)
storageBucket: "my-bucket.appspot.com",
});
Furthermore, I have tried adding IAM roles to the service account:

What I am trying to accomplish is simply what is done in the before-mentioned docs:
// Triggered from storage.object().onFinalize(generateThumbnail);
const bucket = getStorage().bucket(object.bucket);
...
// Cloud Storage files.
const file = bucket.file(filePath);
const url = await getDownloadURL(file);
console.log({ url });
What is going wrong here, as the docs states clearly I firebase admin sdk should have access by default?
Stacktrace: (from emulator)
⚠ functions: Error: Permission denied. No READ permission.
at new ApiError (/../functions/node_modules/firebase-admin/node_modules/@google-cloud/storage/build/src/nodejs-common/util.js:80:15)
at Util.parseHttpRespBody (/../functions/node_modules/firebase-admin/node_modules/@google-cloud/storage/build/src/nodejs-common/util.js:215:38)
at Util.handleResp (/../functions/node_modules/firebase-admin/node_modules/@google-cloud/storage/build/src/nodejs-common/util.js:156:117)
at /../functions/node_modules/firebase-admin/node_modules/@google-cloud/storage/build/src/nodejs-common/util.js:538:22
at onResponse (/../functions/node_modules/firebase-admin/node_modules/retry-request/index.js:240:7)
at /../functions/node_modules/firebase-admin/node_modules/teeny-request/build/src/index.js:217:17
at processTicksAndRejections (node:internal/process/task_queues:96:5)
My service account file:
{
"type":"..",
"project_id":"..",
"private_key_id":"..",
"private_key":"..",
"client_email":"..",
"client_id":"..",
"auth_uri":"..",
"token_uri":"..",
"auth_provider_x509_cert_url":"..",
"client_x509_cert_url":"..",
"universe_domain":"..",
}
- 主要语言
- 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
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
mksglu/context-mode#1200 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/claude-code#96687 ·
-
good first issue
难度 1/5 1 小时以内 新手友好度 95/100
AOSSIE-Org/DebateAI#582 · 2 条评论 ·