FirebaseError:存储桶名称未指定或无效

yah*_*s23 6 bucket firebase reactjs firebase-storage

我正在按照在线教程使用 Firebase on React 构建社交媒体应用程序。

我发现非常令人困惑的是,当我创建新用户时,我可以访问存储桶,并从我在 Firebase 存储中上传的图片(使用存储桶端点)设置默认注册图像。

但是,当我尝试使用相同的存储桶端点和不同的图像文件发送 POST 请求来更新图像时,出现以下错误:

FirebaseError: Bucket name not specified or invalid. Specify a valid bucket name via the storageBucket option when initializing the app, or specify the bucket name explicitly when calling the getBucket() method.
Run Code Online (Sandbox Code Playgroud)
 at new FirebaseError (/Users/yousef/codeclan_work/run_dat/functions/node_modules/firebase-admin/lib/utils/error.js:42:28)
 at Storage.bucket (/Users/yousef/codeclan_work/run_dat/functions/node_modules/firebase-admin/lib/storage/storage.js:109:15)
 at Busboy.<anonymous> (/Users/yousef/codeclan_work/run_dat/functions/handlers/users.js:111:25)
 at Busboy.emit (events.js:209:13)
 at Busboy.emit (/Users/yousef/codeclan_work/run_dat/functions/node_modules/busboy/lib/main.js:37:33)
 at /Users/yousef/codeclan_work/run_dat/functions/node_modules/busboy/lib/types/multipart.js:52:13
 at processTicksAndRejections (internal/process/task_queues.js:75:11) {
Run Code Online (Sandbox Code Playgroud)
>    errorInfo: {
>      code: 'storage/invalid-argument',
>      message: 'Bucket name not specified or invalid. Specify a valid bucket name via the storageBucket option when initializing the app, or specify the bucket name explicitly when calling the getBucket() method.'
Run Code Online (Sandbox Code Playgroud)

我通过以下方式访问两个存储桶:

https://firebasestorage.googleapis.com/v0/b/${config.storageBucket}/o/${ImgFile}?alt=media

我尝试手动输入存储桶而不是传递值,但仍然遇到相同的错误。

小智 13

我遇到了同样的问题,对我来说,在初始化管理员时指定默认存储桶是有效的。//管理.js

const admin = require("firebase-admin");
admin.initializeApp({
    credential: admin.credential.cert(serviceAccount),
    storageBucket: "<BUCKET_NAME>.appspot.com"
});
Run Code Online (Sandbox Code Playgroud)


Fra*_*len 2

火力战士在这里

如果这是您在过去 24 小时内创建的项目,则可能与此事件有关:https://status.firebase.google.com/incident/Storage/20001

为新项目创建存储桶时出现问题,因此我建议在 Firebase 控制台中打开“存储”面板,或创建一个新项目。

如果问题仍然存在,请联系 Firebase 支持人员以获取故障排除方面的个性化帮助。