FirebaseExtended / action-hosting-deploy

Automatically deploy shareable previews for your Firebase Hosting sites
https://firebase.google.com/docs/hosting/github-integration
Apache License 2.0
705 stars 202 forks source link

[BUG] Firebase Init Failure for Org Repository Hosting even with Organizational Access Allowed #136

Open joshelson opened 3 years ago

joshelson commented 3 years ago

Found the other open issue with organizational access not allowed, but I have organizational access to Firebase CLI and I am still getting this error.

Debug output here:

 ✔  Success! Logged into GitHub as joshelson

[2021-07-06T00:55:22.569Z] >>> [apiv2][query] GET https://api.github.com/repos/undefined [none]
[2021-07-06T00:55:24.469Z] <<< [apiv2][status] GET https://api.github.com/repos/undefined 404
[2021-07-06T00:55:24.469Z] <<< [apiv2][body] GET https://api.github.com/repos/undefined {"message":"Not Found","documentation_url":"https://docs.github.com/rest"}

Error: HTTP Error: 404, Not Found
[2021-07-06T00:55:26.197Z] Error Context: {
  "body": {
    "message": "Not Found",
    "documentation_url": "https://docs.github.com/rest",
    "error": {
      "message": "Not Found"
    }
  },
  "response": {
    "statusCode": 404
  }
}
riker09 commented 3 years ago

You mean issue #40? Did you try the suggested solution from this comment? My apologies, but it isn't clear from your comment.

3ximus commented 3 years ago

I have the same issue, I have granted firebase access to the organization but I still get the Error: HTTP Error: 404, Not Found when running firebase init and Error: An unexpected error has occurred. when running firebase init hosting:github with this log:

[info] ✔  Uploaded service account JSON to GitHub as secret FIREBASE_SERVICE_ACCOUNT_CENTEC_WEBPAGE. 
[info] i  You can manage your secrets at https://github.com/CENTEC-IST/webpage/settings/secrets 
[info] 
[debug] [2021-10-27T05:10:41.836Z] TypeError: Cannot read property 'predeploy' of undefined
    at Object.initGitHub [as hosting:github] (/usr/local/lib/node_modules/firebase-tools/lib/init/features/hosting/github.js:65:30)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async init (/usr/local/lib/node_modules/firebase-tools/lib/init/index.js:19:9)
[error] 
[error] Error: An unexpected error has occurred.

Don't know if there's something I've missed for my case, this is the first time I'm setting up firebase...

riker09 commented 3 years ago

@3ximus Your error seems to be something else: TypeError: Cannot read property 'predeploy' of undefined I think this might come from a misconfigured firebase.json and more specifically the functions configuration.

Here's an excerpt from my firebase.json:

{
  "functions": {
    "source": "functions",
    "predeploy": [
      "npm run lint --workspace \"$RESOURCE_DIR\"",
      "npm run build --workspace \"$RESOURCE_DIR\""
    ]
  },

  // ...
}

tl;dr: Check and make sure that your firebase.json is valid.

3ximus commented 3 years ago

I generated it through the CLI but selecting both these options for Hosting at the same time created this problem for me:

Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys
Hosting: Set up GitHub Action deploys

Choosing only the first option fixes it for me. Cheers