.firebaserc and firebase cli completely ignored
See original GitHub issueIf 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:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Hi this is working (ish) as intended – the real question is how the
site
field got populated into yourfirebase.json
in the first place (since it sounds like you didn’t do it?). Are you sure it was injected by afirebase
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
andsite
. The one we want folks to use istarget
(see docs) which allows for per-project aliasing of sites to allow for multiple environments. However we do also support an absolute uniquesite
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.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.