action-hosting-deploy icon indicating copy to clipboard operation
action-hosting-deploy copied to clipboard

[BUG] Deploy target not configured for project

Open BossBele opened this issue 4 years ago • 10 comments

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 avatar Apr 10 '21 16:04 BossBele

@expatiating You gotta be experienced in this

BossBele avatar Apr 10 '21 16:04 BossBele

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:

  • myapp-dev
    • myapp-dev-site1.web.app
    • myapp-dev-site2.web.app
  • myapp-prod
    • myapp-prod-site1.web.app
    • myapp-prod-site2.web.app

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?

davemaul avatar Apr 15 '21 20:04 davemaul

@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.

ItayElgazar avatar Jan 14 '22 08:01 ItayElgazar

@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. :)

davemaul avatar Jan 14 '22 08:01 davemaul

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

ItayElgazar avatar Jan 14 '22 09:01 ItayElgazar

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.

SaadArdati avatar Mar 31 '23 12:03 SaadArdati

Same issue here

mvarchdev avatar Oct 17 '23 11:10 mvarchdev

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

"hosting" : {
    "site": ""
}

JamesVanWaza avatar Oct 23 '23 17:10 JamesVanWaza

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>

igorjacauna avatar Jan 03 '24 12:01 igorjacauna