Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.firebaserc and firebase cli completely ignored #2558

Closed
elucidsoft opened this issue Aug 19, 2020 · 6 comments · Fixed by #3989
Closed

.firebaserc and firebase cli completely ignored #2558

elucidsoft opened this issue Aug 19, 2020 · 6 comments · Fixed by #3989
Assignees

Comments

@elucidsoft
Copy link

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.

@google-oss-bot
Copy link
Contributor

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@elucidsoft
Copy link
Author

firebase --version
8.7.0

@elucidsoft
Copy link
Author

Something I didn't clarify, dev-land-9008c is not the same project as dev-land. Completely different projects!

@samtstern
Copy link
Contributor

@elucidsoft ok it sounds like at the very least we need to improve our logging messages! It may also be a bug, @bkendall can comment on that.

When you create a new Firebase Project there is exactly one "site". However you can have more than one site per project:
https://firebase.google.com/docs/hosting/multisites

So changes we could make:

  1. The logs should definitely declare what site they are deploying to if it's not equal to the project ID
  2. I think it would be reasonable if we checked that the site actually belongs to the targeted project, but maybe @bkendall will explain to me why that's not a good idea.

@mbleigh
Copy link
Contributor

mbleigh commented 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.

@elucidsoft
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants