firebase-tools-docker icon indicating copy to clipboard operation
firebase-tools-docker copied to clipboard

CORS issue

Open rockoo opened this issue 4 years ago • 1 comments

Hi. I can't get the tools to work properly. I can access the UI with no problem on port 4000 but every request to emulators fails with CORS preflight not passing.

This is my config

{
  "emulators": {
    "auth": {
      "port": 9099
    },
    "firestore": {
      "port": 8080
    },
    "ui": {
      "enabled": true,
      "host": "0.0.0.0",
      "port": 4000
    }
  }
}

I have tried adding host to each of the emulators as well but nothing helps. Any ideas? cors issue

rockoo avatar Jan 07 '21 16:01 rockoo

Actually I had a similar problem, and I solved it by adding "host": "0.0.0.0" to each of the emulators I was using. Now, when opening localhost:4000 on Docker host machine, it is able to find and access the firestore emulator and function logs.

My config:

  "emulators": {
    "functions": {
      "host": "0.0.0.0",
      "port": 5001
    },
    "logging": {
      "host": "0.0.0.0",
      "port": 4500
    },
    "firestore": { 
      "host": "0.0.0.0",
      "port": 8080
    },
    "hosting": {
      "port": 5000
    },
    "pubsub": {
      "port": 8085
    },
    "ui": {
      "enabled": true,
      "host": "0.0.0.0",
      "port": 4000
    }
  }

apata avatar Jan 19 '21 10:01 apata