question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.firebaserc and firebase cli completely ignored

See original GitHub issue

If you have a .firebaserc file setup

{
  "projects": {
    "dev": "dev-land",
    "stage": "stage-land",
    "prod": "prod-land",
    "default": "dev-land"
  }
}

And have a firebase.json like this

{
  "hosting": {
    "public": "dist",
    "rewrites": [{
      "source": "**",
      "destination": "/index.html"
    }],
    "site": "dev-land-9008c",
    "ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
  }
}

Some firebase command or process puts the “site”: “dev-land-9008c”, line in there, not sure what does it. Doesn’t really matter. What matters is the behaviors observed when this line exists. This line overrides .firebaserc, and also overrides ALL cli commands.

if you run: firebase use dev the CLI reports back that it successfully switched to ‘dev-land’

If you then run firebase deploy it will say ‘=== Deploying to dev-land…’ but then in the status updates it will say 'Deployed successfully to ‘dev-land-9008c’.

If you run firebase deploy --project dev-land same thing, it reports its deploying to ‘dev-land’ but deploys to ‘dev-land-9008c’ instead.

If you delete .firebaserc, and redo all of it using firebase use --add, same behavior. If you run firebase use --clear, same behavior. If you re-run firebase init, same behavior.

Needless to say this took me over 3 hours to find, EXTREMELY frustrating. It started in my CI/CD pipeline, I spent 2 hours there, then noticed it was happening locally. Like I said I have no idea what adds the site line to firebase.json but that line shouldn’t exist. Especially with the aliasing, and .firebaserc. That should be removed entirely, beyond confusing.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mbleighcommented, Aug 19, 2020

Hi this is working (ish) as intended – the real question is how the site field got populated into your firebase.json in the first place (since it sounds like you didn’t do it?). Are you sure it was injected by a firebase command? Can you reproduce this (if so please let us know where it’s happening)?

Firebase Hosting supports multiple sites in a single project directory through two mechanisms: target and site. The one we want folks to use is target (see docs) which allows for per-project aliasing of sites to allow for multiple environments. However we do also support an absolute unique site value that is independent of project.

I agree with Sam that we should consider erroring out if the site in question does not match the current project.

0reactions
elucidsoftcommented, Aug 20, 2020

I don’t recall ever adding that sites line but honestly I can’t say with any degree of certainty that a tool added it or I did.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase CLI reference
The Firebase CLI requires a browser to complete authentication, but the CLI is fully ... The list of files ignored by default, shown...
Read more >
Realtime database emulator ignores database.rules.json
Unfortunately, it seems that the Firebase-cli is ingoring my database.rules.json file. This happens even after creating a test project to ...
Read more >
Configure Firebase hosting emulator - CloudBytes/dev
Review the Firebase CLI configuration. The above configuration would have created two files .firebaserc : Contains the project list and aliases.
Read more >
Deploy multiple firebase sites with Google cloud build - Vincent
firebaserc file contain some project specific information for use by the firebase CLI internally. Usually the .firebaserc file is added to the ....
Read more >
Automatically deploy a Gatsby site to Firebase Hosting - CircleCI
After the prompts are complete, the Firebase CLI generates two files: .firebaserc; firebase.json. Note: The firebase.json file enables ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found