由于云资源位置而无法初始化 Firebase 云存储

问题描述 投票:0回答:1

我正在使用 Firebase 模拟器在本地开发和测试 Cloud Functions,我的用例之一涉及将文件上传到 Cloud Storage。作为此过程的一部分,我使用 Cloud Storage 服务初始化 Firebase 模拟器,如下所示:

npx firebase init emulators

=== Emulators Setup
? Which Firebase emulators do you want to set up? Press Space to select emulators, then Enter to confirm your choices. Storage 
Emulator
? Which port do you want to use for the storage emulator? 9199
? Would you like to enable the Emulator UI? Yes
? Which port do you want to use for the Emulator UI (leave empty to use any available port)? 
? Would you like to download the emulators now? Yes

然后我尝试启动 firebase 模拟器进行云存储,但出现错误:

npx firebase emulators:start --only storage

Error: Cannot start the Storage emulator without rules file specified in firebase.json: run 'firebase init' and set up your Storage configuration

这是有道理的,因为需要在模拟器启动 Cloud Storage 之前创建 storage.rules 文件。所以,接下来我跑了:

npx firebase init storage

=== Storage Setup
Error: Cloud resource location is not set for this project but the operation you are attempting to perform in Cloud Storage requires it. Please see this documentation for more details: https://firebase.google.com/docs/projects/locations

我转到 Firebase 控制台,启用存储并选择服务位置,该位置与我正在使用的所有其他 Firebase 服务的位置相匹配。然而,即使几个小时后,我仍然收到相同的错误消息,就好像我的本地 Firebase 设置无法识别存储服务已激活一样。

环境详情:

•   macOS Sequoia 15.0
•   VS Code 1.95.1
•   Node.js v18 (also tried with v20 and v22)
•   Firebase CLI 13.23.1
node.js firebase google-cloud-functions firebase-storage firebase-tools
1个回答
0
投票

firebase-tools v13.24.1 中发布了修复程序。请参阅 https://github.com/firebase/firebase-tools/releases/tag/v13.24.1https://github.com/firebase/firebase-tools/pull/7905。升级到最新版本(或至少 v13.4.1)应该可以解决这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.