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] Deploy target not configured for project #112

Open BossBele opened 3 years ago

BossBele commented 3 years ago

Action config

      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_MABROUK_IMS }}"
          channelId: live
          projectId: "${{ secrets.PROJECT_ID }}"
          target: "${{ secrets.TARGET_ID }}"
        env:
          FIREBASE_CLI_PREVIEWS: hostingchannels

Error message

/usr/local/bin/npx firebase-tools deploy --only hosting:*** --project *** --json
  ***
    "status": "error",
    "error": "Deploy target \u001b[1m***\u001b[22m not configured for project \u001b[1m***\u001b[22m. Configure with:\n\n  firebase target:***ly hosting *** <resources...>"
  ***
  ***
    "status": "error",
    "error": "Deploy target \u001b[1m***\u001b[22m not configured for project \u001b[1m***\u001b[22m. Configure with:\n\n  firebase target:***ly hosting *** <resources...>"
  ***

  The process '/usr/local/bin/npx' failed with exit code 1
  Retrying deploy with the --debug flag for better error output

  /usr/local/bin/npx firebase-tools deploy --only hosting:*** --project *** --debug
  [2021-04-10T16:23:03.389Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
  [2021-04-10T16:23:03.485Z] [iam] checking project *** for permissions ["firebase.projects.get","firebasehosting.sites.update"]
  [2021-04-10T16:23:03.487Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/***:testIamPermissions  
   ***"permissions":["firebase.projects.get","firebasehosting.sites.update"]***
  [2021-04-10T16:23:03.556Z] <<< HTTP RESPONSE 200 ***"content-type":"***lication/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Sat, 10 Apr 2021 16:23:03 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","server-timing":"gfet4t7; dur=42","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"***
  [2021-04-10T16:23:03.559Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/*** [none]
  [2021-04-10T16:23:03.976Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/*** 200
  [2021-04-10T16:23:03.976Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/*** ***"projectId":"***","projectNumber":"21623471325","displayName":"***","name":"projects/***","resources":***"hostingSite":"***","realtimeDatabaseInstance":"***","storageBucket":"***.***spot.com","locationId":"europe-west"***,"state":"ACTIVE"***

Unexpected behavior

When I push .firebaserc to my repo, action succeeds. When I use projectId and target, action fails.

BossBele commented 3 years ago

@expatiating You gotta be experienced in this

davemaul commented 3 years ago

I have the same problem when implementing the workflow described here. The only difference to my setup is that I have multiple sites, too. As SITE_ID must be globally unique within Firebase (docs), I can't define my targets in .firebaserc. Let me explain this with my setup.

These are my two Firebase Projects with their own hosting sites:

I'm not sure what's the best solution for this problem. My first thought was letting the user define some script which gets executed in this action before the deploy so this becomes possible. Any ideas?

ItayElgazar commented 2 years ago

@logineimer, I'm experiencing the same issue! Did you find any solution? I discovered that you could specify the config source like this$ firebase --config=./firebase-main.json deploy, but there's no support for this in this project. I guess I'll try to add one.

davemaul commented 2 years ago

@ItayElgazar, unfortunately not. I changed my site setup to one hosting site. This works out for me for multiple reasons. However, I'd still like to this issue resolved. :)

ItayElgazar commented 2 years ago

I added the support to use --config, but it looks like nobody approves PRs here 😞

SaadArdati commented 1 year ago

I was getting this, but it turns out I didn't have my .firebaserc file committed! It works perfectly now! Running firebase target:.... actually updates the .firebaserc file.

mvarchdev commented 1 year ago

Same issue here

JamesVanWaza commented 1 year ago

@mvarchdev is your .firebaserc file ignored or commited? Also in firebase.json do you see site under hosting?

"hosting" : {
    "site": ""
}
igorjacauna commented 10 months ago

For me, solved when update the .firebaserc with:

{
  "projects": {
    "default": "<project-id>"
  },
+ "targets": {
+   "<project-id>": {
+     "hosting": {
+       "<target>": [
+         "<site-name>"
+       ],
+       "<target-2>": [
+         "<site-name-2>"
+       ]
+     }
+   }
+ }
}

And in Github action YAML added the target configured in .firebaserc:

     - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: '${{ secrets.GITHUB_TOKEN }}'
          firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
          channelId: live
          projectId: <project-id>
+         target: <target>
yorikworld commented 4 months ago

The multi-sites work for me when I remove the "default" setting. From this:

"projects": { "default": "<project-id>" }, to this: "projects": {},