LoginSignup
2
1

More than 1 year has passed since last update.

【解決】Cloud Firestoreのエミュレーターがタイムアウトする

Posted at

現象

Firestoreのエミューレーターがタイムアウトする

$ yarn add --dev firebase-tools
$ yarn firebase init
? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confirm your choices. (Press <space> to select, <
a> to toggle all, <i> to invert selection, and <enter> to proceed)
❯◉ Emulators: Set up local emulators for Firebase products
# エミュレーターを設定
...
=== Emulators Setup
? Which Firebase emulators do you want to set up? Press Space to select emulators, then Enter to confirm your choices. (Press <space> to select, <a> to toggle all,
 <i> to invert selection, and <enter> to proceed)
❯◉ Firestore Emulator
# Firestoreのエミューレーターを設定
...

$ yarn firebase emulators:start
⚠  emulators: Support for Java version <= 10 will be dropped soon in firebase-tools@11. Please upgrade to Java version 11 or above to continue using the emulators.
i  emulators: Starting emulators: firestore, hosting
i  firestore: Firestore Emulator logging to firestore-debug.log
i  emulators: Shutting down emulators.
i  firestore: Stopping Firestore Emulator
i  hub: Stopping emulator hub

Error: TIMEOUT: Port 8080 on localhost was not active within 60000ms

期待する結果

ググって出てくる他の人を参考にするとこんな感じになってほしい

$ yarn firebase emulators:start
...
┌───────────┬────────────────┬─────────────────────────────────┐
│ Emulator  │ Host:Port      │ View in Emulator UI             │
├───────────┼────────────────┼─────────────────────────────────┤
│ Firestore │ localhost:8080 │ http://localhost:4000/firestore │
└───────────┴────────────────┴─────────────────────────────────┘

解決方法

"host": "127.0.0.1"firebase.json設定に追加

firebase.json
{
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "emulators": {
    "firestore": {
      "port": 8080,
      "host": "127.0.0.1"
    },
    "ui": {
      "enabled": true
    }
  }
}
$ yarn firebase emulators:start
⚠  emulators: Support for Java version <= 10 will be dropped soon in firebase-tools@11. Please upgrade to Java version 11 or above to continue using the emulators.
i  emulators: Starting emulators: firestore, hosting
i  firestore: Firestore Emulator logging to firestore-debug.log
i  hosting: Serving hosting files from: public
✔  hosting: Local server: http://localhost:5000
i  ui: Emulator UI logging to ui-debug.log

┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
│ i  View Emulator UI at http://localhost:4000                │
└─────────────────────────────────────────────────────────────┘

┌───────────┬────────────────┬─────────────────────────────────┐
│ Emulator  │ Host:Port      │ View in Emulator UI             │
├───────────┼────────────────┼─────────────────────────────────┤
│ Firestore │ 127.0.0.1:8080 │ http://localhost:4000/firestore │
├───────────┼────────────────┼─────────────────────────────────┤
  Emulator Hub running at localhost:4400
  Other reserved ports: 4500

環境

OS: macOS Monterey
Intel CPU

$ node -v
v17.2.0
$ yarn -v
1.22.17
$ firebase --version
10.6.0
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1