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

Error message when running init hosting:github on a fresh project #3113

devpeerapong opened this issue Feb 7, 2021 · 5 comments · Fixed by #3114

Error message when running init hosting:github on a fresh project #3113

devpeerapong opened this issue Feb 7, 2021 · 5 comments · Fixed by #3114


Copy link

devpeerapong commented Feb 7, 2021

[REQUIRED] Environment info

firebase-tools: 9.3.0

Platform: macOS 11.1

[REQUIRED] Test case

As the document said, The firebase init hosting:github should only run on the project that is already setup Hosting.
But many of us mis-read the document and try to run it on the 1st setup instead.
The CLI should throw a user-friendly message when the user tries to run firebase init hosting:github on a project that has not setup with Hosting

[REQUIRED] Steps to reproduce

  1. Create an empty folder or bootstrap with create-react-app
  2. Run firebase init hosting:github

[REQUIRED] Expected behavior

The CLI should bail out with a user-friendly message because the project is not setup with Hosting

[REQUIRED] Actual behavior

The CLI throw an error after generate Service Account and push into Github Secret

✔  Created service account github-action-336487343 with Firebase Hosting admin permissions.
✔  Uploaded service account JSON to GitHub as secret FIREBASE_SERVICE_ACCOUNT_EXPERIMENT_49E67.
i  You can manage your secrets at

Error: An unexpected error has occurred.

As you can see, The error message is not very helpful at all.

Running with --debug show us this

[2021-02-07T04:02:16.951Z] TypeError: Cannot read property 'predeploy' of undefined
    at Object.initGitHub [as hosting:github] (/Users/peerapong/
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async init (/Users/peerapong/

The CLI tries to get the predeploy from the Hosting config that's not exist.
I suggest that we bail out early when the command is run on the project that has not setup with Hosting with a message that direct the user to use init hosting.

I've create a PR #3114 for this.

Copy link

elron commented Sep 24, 2021

This happens in Windows 10 as well.

Copy link

JhaAman commented Sep 30, 2021

I’m at least grateful for this Github issue for helping me figure out what the problem was when I googled it.

Copy link

It fails on Ubuntu 20.04 as well.

Copy link


Copy link

@devpeerapong's fix (#3114) has shipped in v9.23.2

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