Realtime Database を使う Firebaseプロジェクトで、これまでのように Google Cloud Shell
で
...▼
$ firebase initしたところエラー。
$ npm -v9.8.1
$ firebase --version12.4.6
...▼
: === Project Setup First, let's associate this project directory with a Firebase project. You can create multiple project aliases by running firebase use --add, but for now we'll just set up a default project. ? Please select an option: Use an existing project ? Select a default Firebase project for this directory: try1-e3fc7 (try1) i Using project try1-e3fc7 (try1) === Database Setup i database: ensuring required API firebasedatabase.googleapis.com is enabled... ✔ database: required API firebasedatabase.googleapis.com is enabled Error: Failed to get instance details for instance: try1-e3fc7-default-rtdb. See firebase-debug.log for more details.[firebase-debug.log]を見ると
: === Project Setup : === Database Setup : [debug] [2022-08-15T01:34:58.344Z] HTTP Error: 403, Your application is authenticating by using local Application Default Credentials. The firebasedatabase.googleapis.com API requires a quota project, which is not set by default. To learn how to set your quota project, see https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds . [debug] [2022-08-15T01:34:58.345Z] FirebaseError: HTTP Error: 403, Your application is authenticating by using local Application Default Credentials. The firebasedatabase.googleapis.com API requires a quota project, which is not set by default. To learn how to set your quota project, see https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds . at responseToError (/usr/local/nvm/versions/node/v18.12.1/lib/node_modules/firebase-tools/lib/responseToError.js:49:12) at RetryOperation._fn (/usr/local/nvm/versions/node/v18.12.1/lib/node_modules/firebase-tools/lib/apiv2.js:285:77) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)で停止。Windows11にインストールしたFirebaseコマンドでは正常なので環境の問題。 [firebase-debug.log]に示されるURL
https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds
を参照すると認証が関係している模様。
firebase loginすると認証ページがローカルホストにつながろうとして行方不明に。https://qiita.com/Yatima/items/f550951ceb830f934dfd によれば、
firebase login --no-localhostで改善。
Realtime Database の初期化も解決。