无法访问上传到 Firebase 存储的文件

时间:2021-05-13 22:05:23

标签: node.js express firebase-storage

我在 NodeJS 中有以下代码,用于接受从客户端到 ExpressJS 服务器的文件上传。

文件随后上传到 firebase 存储,如下所示

 firebase.storage().bucket().upload(tempFilePath, {
                        gzip: true,
                        metadata: {
                            cacheControl: 'public, max-age=31536000',
                        },
                    }).then((response) => {
                        let uploadedFilePath = response[0]['metadata']['selfLink']; //Download Path
                        uploadResults[fileName] = uploadedFilePath;
                        fs.unlink(tempFilePath, (_err, _data) => {
                        });
                        targetObject._checkAndSendUploadResultsBackToCaller(cb, uploadResults, files, null);
                    });

很遗憾,客户端无法访问从 firebase 返回的文件路径作为下载链接。

我一直在接受

Anonymous caller does not have storage.objects.get access to the google cloud storage object

请问,我该如何解决这个问题。

0 个答案:

没有答案
相关问题