Skip to content

specifying --config <path> also loads parts of firebase.json #9773

@trullock

Description

@trullock

[REQUIRED] Environment info

firebase-tools: 15.2.1

Platform: Ubuntu

[REQUIRED] Test case

I want to have cache headers when deployed to live, but not on dev.
So I've made a firebase.dev.json which is a copy of firebase.json, but without the hosting.headers section.
However, when running firebase emulators:start --config ./firebase.dev.json it also seems to load the firebase.json because requests are returning the configured headers.
I've verified this by adding the following header

{
        "source": "/",
        "headers": [
          {
            "key": "WTF",
            "value": "is going on?"
          }
        ]
}

to hosting.headers in firebase.json, rebooting the emulators and this header appears (so its not browser caching or anything else mad, its genuinely coming from the firebase.json.

So then I made the assumption that it must merge firebase.json with whatever your provide to --config despite this being undocumented.
So i make a base firebase.json, then firebase.dev.json is just {} and firebase.prod.json just has {hosting: headers: [ ... ] } in it, but then invoking the emulator with --config ./firebase.dev.json complains that all other sections are missing, which they are.

So it isnt merging the whole file, it looks like just the hosting emulator always loads firebase.json regardless of --config and then applies ---config <path> over the top.

Insanity

[REQUIRED] Steps to reproduce

firebase.json

// usual stuff plus:

    "headers": [
      {
        "source": "/",
        "headers": [
          {
            "key": "WTF",
            "value": "is going on?"
          }
        }

firebase.dev.json

// usual stuff but no "headers"

run firebase emulators:start --config ./firebase.dev.json

request localhost:5000/

observe the presence of the WTF header

[REQUIRED] Expected behavior

--config only loads the provided config.json

[REQUIRED] Actual behavior

Hosting emulator seems to always load at least the headers section from firebase.json, havent tested other sections

Theres nothing in the logs of any value, it doesn't print anything to say which config file its loaded except repeating the Command you use to invoke it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions