title: How to specify the host:port of the functions emulator without starting the functions emulator
body: <p>I'm writing cloud functions in Go and triggering them from the firestore emulator. This works if I manually start the firestore emulator:</p>
  <pre><code> java -jar ~/.cache/firebase/emulators/cloud-firestore-emulator-v1.11.9.jar \
    --functions_emulator localhost:5001
  </code></pre>
  <p>Then I start my own server on localhost:5001 to handle the functions that are triggered and everything seems to work.</p>
  <p>However, I'd like to start the firestore emulator in the normal way
  so that I get the nice web UI, etc. My firebase.json file is as follows:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;emulators&quot;: {
      &quot;firestore&quot;: {
        &quot;port&quot;: 8080
      },
      &quot;functions&quot;: {
        &quot;port&quot;: 5001
      },
      &quot;pubsub&quot;: {
        &quot;port&quot;: 8085
      },
      &quot;ui&quot;: {
        &quot;enabled&quot;: true
      },
      &quot;hosting&quot;: {
        &quot;port&quot;: 5000
      },
      &quot;auth&quot;: {
        &quot;port&quot;: 9099
      }
    },
    &quot;ui&quot;: {
      &quot;enabled&quot;: true,
      &quot;host&quot;: &quot;localhost&quot;,
      &quot;port&quot;: 4000
    },
    &quot;functions&quot;: {
      &quot;port&quot;: &quot;5001&quot;,
      &quot;predeploy&quot;: [
        &quot;npm --prefix \&quot;$RESOURCE_DIR\&quot; run lint&quot;,
        &quot;npm --prefix \&quot;$RESOURCE_DIR\&quot; run build&quot;
      ],
      &quot;source&quot;: &quot;functions&quot;
    },
    &quot;pubsub&quot;: {
      &quot;port&quot;: &quot;8085&quot;
    },
    &quot;firestore&quot;: {
      &quot;rules&quot;: &quot;firestore.rules&quot;,
      &quot;indexes&quot;: &quot;firestore.indexes.json&quot;
    },
    &quot;hosting&quot;: {
      &quot;public&quot;: &quot;build&quot;,
      &quot;ignore&quot;: [
        &quot;firebase.json&quot;,
        &quot;**/.*&quot;,
        &quot;**/node_modules/**&quot;
      ],
      &quot;rewrites&quot;: [
        {
          &quot;source&quot;: &quot;**&quot;,
          &quot;destination&quot;: &quot;/index.html&quot;
        }
      ]
    }
  }
  
  </code></pre>
  <p>I start the emulators using</p>
  <pre class="lang-sh prettyprint-override"><code>firebase emulators:start --only firestore
  </code></pre>
  <p>Then I set up a trigger on firestore using the following command:</p>
  <pre class="lang-sh prettyprint-override"><code>#!/bin/zsh
  
  TRIGGER='http://localhost:8080/emulator/v1/projects/fugalist/triggers/Requests'
  
  curl --location --request PUT ${TRIGGER} \
      --header 'Content-Type: application/json' \
      --data-raw '{
          &quot;eventTrigger&quot;: {
            &quot;resource&quot;: &quot;projects/fugalist/databases/(default)/documents/Requests/{doc}&quot;,
            &quot;eventType&quot;: &quot;providers/cloud.firestore/eventTypes/document.create&quot;,
            &quot;service&quot;: &quot;firestore.googleapis.com&quot;
        }
      }'
  </code></pre>
  <p>Finally, I manually create a document under /Requests. The firestore-debug.log now contains:</p>
  <pre><code>[debug] [2020-11-10T21:09:20.187Z] ----------------------------------------------------------------------
  [debug] [2020-11-10T21:09:20.189Z] Command:       /usr/local/Cellar/node/12.4.0/bin/node /Users/michaelcoffin/node_modules_global/bin/firebase emulators:start --only firestore
  [debug] [2020-11-10T21:09:20.189Z] CLI Version:   8.15.0
  [debug] [2020-11-10T21:09:20.189Z] Platform:      darwin
  [debug] [2020-11-10T21:09:20.189Z] Node Version:  v12.4.0
  [debug] [2020-11-10T21:09:20.190Z] Time:          Tue Nov 10 2020 13:09:20 GMT-0800 (Pacific Standard Time)
  [debug] [2020-11-10T21:09:20.190Z] ----------------------------------------------------------------------
  [debug] [2020-11-10T21:09:20.190Z] 
  [debug] [2020-11-10T21:09:20.197Z] &gt; command requires scopes: [&quot;email&quot;,&quot;openid&quot;,&quot;https://www.googleapis.com/auth/cloudplatformprojects.readonly&quot;,&quot;https://www.googleapis.com/auth/firebase&quot;,&quot;https://www.googleapis.com/auth/cloud-platform&quot;]
  [debug] [2020-11-10T21:09:20.197Z] &gt; authorizing via signed-in user
  [info] i  emulators: Starting emulators: firestore {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;hub&quot;},&quot;message&quot;:&quot;Starting emulators: firestore&quot;}}
  [debug] [2020-11-10T21:09:20.210Z] [hub] writing locator at /var/folders/xy/m2rx3tw14mnfvryxx2jvhyjh0000gn/T/hub-fugalist.json
  [debug] [2020-11-10T21:09:20.229Z] Ignoring unsupported arg: projectId {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Ignoring unsupported arg: projectId&quot;}}
  [debug] [2020-11-10T21:09:20.229Z] Ignoring unsupported arg: auto_download {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Ignoring unsupported arg: auto_download&quot;}}
  [debug] [2020-11-10T21:09:20.229Z] Starting Firestore Emulator with command {&quot;binary&quot;:&quot;java&quot;,&quot;args&quot;:[&quot;-Duser.language=en&quot;,&quot;-jar&quot;,&quot;/Users/michaelcoffin/.cache/firebase/emulators/cloud-firestore-emulator-v1.11.9.jar&quot;,&quot;--host&quot;,&quot;localhost&quot;,&quot;--port&quot;,8080,&quot;--rules&quot;,&quot;/Users/michaelcoffin/expmap/fe/firestore.rules&quot;],&quot;optionalArgs&quot;:[&quot;port&quot;,&quot;webchannel_port&quot;,&quot;host&quot;,&quot;rules&quot;,&quot;functions_emulator&quot;,&quot;seed_from_export&quot;],&quot;joinArgs&quot;:false} {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Starting Firestore Emulator with command {\&quot;binary\&quot;:\&quot;java\&quot;,\&quot;args\&quot;:[\&quot;-Duser.language=en\&quot;,\&quot;-jar\&quot;,\&quot;/Users/michaelcoffin/.cache/firebase/emulators/cloud-firestore-emulator-v1.11.9.jar\&quot;,\&quot;--host\&quot;,\&quot;localhost\&quot;,\&quot;--port\&quot;,8080,\&quot;--rules\&quot;,\&quot;/Users/michaelcoffin/expmap/fe/firestore.rules\&quot;],\&quot;optionalArgs\&quot;:[\&quot;port\&quot;,\&quot;webchannel_port\&quot;,\&quot;host\&quot;,\&quot;rules\&quot;,\&quot;functions_emulator\&quot;,\&quot;seed_from_export\&quot;],\&quot;joinArgs\&quot;:false}&quot;}}
  [info] i  firestore: Firestore Emulator logging to firestore-debug.log {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Firestore Emulator logging to \u001b[1mfirestore-debug.log\u001b[22m&quot;}}
  [debug] [2020-11-10T21:09:21.040Z] API endpoint: http:// {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;API endpoint: http://&quot;}}
  [debug] [2020-11-10T21:09:21.040Z] localhost:8080
  If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:
  
     export FIRESTORE_EMULATOR_HOST=localhost:8080
  
  Dev App Server is now running.
  
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;localhost:8080\nIf you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:\n\n   export FIRESTORE_EMULATOR_HOST=localhost:8080\n\nDev App Server is now running.\n\n&quot;}}
  [warn] ⚠  ui: Emulator UI unable to start on port 4000, starting on 4003 instead. {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;ui&quot;},&quot;message&quot;:&quot;Emulator UI unable to start on port 4000, starting on 4003 instead.&quot;}}
  [debug] [2020-11-10T21:09:21.275Z] Ignoring unsupported arg: auto_download {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;ui&quot;},&quot;message&quot;:&quot;Ignoring unsupported arg: auto_download&quot;}}
  [debug] [2020-11-10T21:09:21.275Z] Ignoring unsupported arg: port {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;ui&quot;},&quot;message&quot;:&quot;Ignoring unsupported arg: port&quot;}}
  [debug] [2020-11-10T21:09:21.275Z] Starting Emulator UI with command {&quot;binary&quot;:&quot;node&quot;,&quot;args&quot;:[&quot;/Users/michaelcoffin/.cache/firebase/emulators/ui-v1.2.2/server.bundle.js&quot;],&quot;optionalArgs&quot;:[],&quot;joinArgs&quot;:false} {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;ui&quot;},&quot;message&quot;:&quot;Starting Emulator UI with command {\&quot;binary\&quot;:\&quot;node\&quot;,\&quot;args\&quot;:[\&quot;/Users/michaelcoffin/.cache/firebase/emulators/ui-v1.2.2/server.bundle.js\&quot;],\&quot;optionalArgs\&quot;:[],\&quot;joinArgs\&quot;:false}&quot;}}
  [info] i  ui: Emulator UI logging to ui-debug.log {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;ui&quot;},&quot;message&quot;:&quot;Emulator UI logging to \u001b[1mui-debug.log\u001b[22m&quot;}}
  [debug] [2020-11-10T21:09:21.369Z] Web / API server started at http://localhost:4003
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;ui&quot;},&quot;message&quot;:&quot;Web / API server started at http://localhost:4003\n&quot;}}
  [info] 
  ┌───────────────────────────────────────────────────────────────────────┐
  │ ✔  All emulators ready! View status and logs at http://localhost:4003 │
  └───────────────────────────────────────────────────────────────────────┘
  
  ┌───────────┬────────────────┬─────────────────────────────────┐
  │ Emulator  │ Host:Port      │ View in Emulator UI             │
  ├───────────┼────────────────┼─────────────────────────────────┤
  │ Firestore │ localhost:8080 │ http://localhost:4003/firestore │
  └───────────┴────────────────┴─────────────────────────────────┘
    Other reserved ports: 4400, 4500
  
  Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.
   
  [debug] [2020-11-10T21:09:24.814Z] Nov 10, 2020 1:09:24 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
  INFO: Detected non-HTTP/2 connection.
  Nov 10, 2020 1:09:24 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
  INFO: Detected non-HTTP/2 connection.
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:09:24 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\nNov 10, 2020 1:09:24 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n&quot;}}
  [debug] [2020-11-10T21:09:24.814Z] Nov 10, 2020 1:09:24 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
  INFO: Detected non-HTTP/2 connection.
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:09:24 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n&quot;}}
  [debug] [2020-11-10T21:09:24.944Z] Nov 10, 2020 1:09:24 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
  INFO: Detected HTTP/2 connection.
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:09:24 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected HTTP/2 connection.\n&quot;}}
  [debug] [2020-11-10T21:09:25.386Z] Nov 10, 2020 1:09:25 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
  INFO: Detected non-HTTP/2 connection.
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:09:25 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n&quot;}}
  [debug] [2020-11-10T21:09:32.373Z] Nov 10, 2020 1:09:32 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
  INFO: Detected non-HTTP/2 connection.
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:09:32 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n&quot;}}
  [debug] [2020-11-10T21:09:40.867Z] Nov 10, 2020 1:09:40 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
  INFO: Detected non-HTTP/2 connection.
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:09:40 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n&quot;}}
  [debug] [2020-11-10T21:09:41.511Z] Nov 10, 2020 1:09:41 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
  INFO: Detected non-HTTP/2 connection.
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:09:41 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n&quot;}}
  [debug] [2020-11-10T21:09:41.521Z] Nov 10, 2020 1:09:41 PM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt
  WARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:09:41 PM com.google.cloud.datastore.emulator.impl.context.EmulatorAuthorization warnAboutSecuredJwt\nWARNING: expected an unsecured JWT, the emulator does not validate JWTs and IS NOT SECURE\n&quot;}}
  [debug] [2020-11-10T21:09:41.629Z] Nov 10, 2020 1:09:41 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
  INFO: Detected non-HTTP/2 connection.
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:09:41 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n&quot;}}
  [debug] [2020-11-10T21:10:21.137Z] Nov 10, 2020 1:10:21 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
  INFO: Detected non-HTTP/2 connection.
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:10:21 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n&quot;}}
  [debug] [2020-11-10T21:10:21.165Z] Nov 10, 2020 1:10:21 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
  INFO: Detected non-HTTP/2 connection.
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:10:21 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n&quot;}}
  [debug] [2020-11-10T21:10:21.179Z] Nov 10, 2020 1:10:21 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
  INFO: Detected non-HTTP/2 connection.
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:10:21 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n&quot;}}
  [debug] [2020-11-10T21:10:21.225Z] Nov 10, 2020 1:10:21 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
  INFO: Detected non-HTTP/2 connection.
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:10:21 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n&quot;}}
  [debug] [2020-11-10T21:10:21.239Z] Nov 10, 2020 1:10:21 PM com.google.cloud.datastore.emulator.impl.events.EventLogger publishEvent
  WARNING: Failed to publish event for trigger projects/fugalist/triggers/Requests because Functions Emulator host/port is not configured.
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:10:21 PM com.google.cloud.datastore.emulator.impl.events.EventLogger publishEvent\nWARNING: Failed to publish event for trigger projects/fugalist/triggers/Requests because Functions Emulator host/port is not configured.\n&quot;}}
  
  </code></pre>
  <p>The relevant part of this, which appears immediately after I manually create a doc, is the last entry:</p>
  <pre><code>WARNING: Failed to publish event for trigger projects/fugalist/triggers/Requests because Functions Emulator host/port is not configured.
   {&quot;metadata&quot;:{&quot;emulator&quot;:{&quot;name&quot;:&quot;firestore&quot;},&quot;message&quot;:&quot;Nov 10, 2020 1:10:21 PM com.google.cloud.datastore.emulator.impl.events.EventLogger publishEvent\nWARNING: Failed to publish event for trigger projects/fugalist/triggers/Requests because Functions Emulator host/port is not configured.\n&quot;}}
  </code></pre>
  <p>Indeed, ps shows that the --functions_emulator flag is not being used in the invocation of the firestore emulator:</p>
  <pre><code>michaelcoffin    98802   0.0  1.6 16006468 536636   ??  Ss    1:09PM   0:06.19 /usr/bin/java -Duser.language=en -jar /Users/michaelcoffin/.cache/firebase/emulators/cloud-firestore-emulator-v1.11.9.jar --host localhost --port 8080 --rules /Users/michaelcoffin/expmap/fe/firestore.rules
  </code></pre>
  <p>And, in fact, it <em>is</em> used if you ask for the functions emulator:</p>
  <pre><code>firebase emulators:start --only firestore,functions
  
  ps output:
  99072   0.0  1.2 15892768 391240   ??  Ss    1:41PM   0:04.17 /usr/bin/java -Duser.language=en -jar /Users/michaelcoffin/.cache/firebase/emulators/cloud-firestore-emulator-v1.11.9.jar --host localhost --port 8080 --rules /Users/michaelcoffin/expmap/fe/firestore.rules --functions_emulator localhost:5001
  </code></pre>
  <p>I understand that this is not exactly a bug, since the emulator suite doesn't officially support Google Cloud Functions written in Go. However, the emulator suite <em>does</em> actually work fine with Go if I start the firestore emulator manually with the --functions_emulator flag. So I'm trying to find a workaround so that the --functions_emulator flag is used even when the functions emulator is not started.</p>