firebase-tools: Error: Hosting target (project-name) not detected in firebase.json

[REQUIRED] Environment info

**firebase-tools:**v8.13.1

**Platform:**macOS

[REQUIRED] Test case

firebase deploy --only hosting:(project-name)

[REQUIRED] Steps to reproduce

I’m using the following Github action: https://github.com/w9jds/firebase-action/ which uses the latest release of firebase-tools. Since the last update, it’s not working anymore. I had to manually set to an older version of firebase-tools (I went for v8.12.1, I haven’t tried with v8.13.0)

[REQUIRED] Expected behavior

Successful deploy

[REQUIRED] Actual behavior

Deploy error Error: Hosting target (project-name) not detected in firebase.json

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 9
  • Comments: 35 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Worked for me, this way (specific firebase-tools version 8.12):

npm install -g firebase-tools@8.12

Then:

firebase deploy -f --project my-project-name --only hosting:my-project-name

npm install -g firebase-tools@8.12 Then: firebase deploy --only hosting:project-name works for me

I am able to replicate this with firebase deploy --only hosting:<project>. Taking a look…

Ack. Thanks everyone for the insights. If we regressed this behavior, makes sense to me that we should restore it. I’ll look into it this morning.

npm install -g firebase-tools@8.12
firebase deploy --only hosting:project-name

works for me as well

only open the directory and open firebase.json

and add “site”: “site-name”

below the second line “hosting”

@bkendall How should hosting be specified until a fix is up?

Follow https://firebase.google.com/docs/hosting/multisites#set_up_deploy_targets

TL;DR

  1. add target id to .firebaserc firebase target:apply hosting blog myapp-blog
  2. add target entry to your firebase.json
  3. deploy

it solved the problem for me with multiple sites in one hosting project

Same here. I’ve always used firebase deploy --only hosting:<name>

Thanks for the tip man! I only got notifications about new posts by mail and that’s fine but here I wanted to reply back to say that my problem was not really a problem at all but a PEBKAC but I could not find the issue thread any more… 😄

I had the same problem: Hosting target (project-name) not detected in firebase.json

I looked at .firabaserc and get the target name

targets": { "XXXXX": { "hosting": { "Teste": [ "XXXXX" ] } }

Then, I ran firebase deploy --only hosting:XXXXX and it worked.

@bkendall How should hosting be specified until a fix is up?

I was presented with the same problem and using an older version of firebase-tools solved the problem. Thanks for your comments. Greetings.

Same here… since two days I am using deploy -P <PROJECT> --only hosting:<SITE NAME>

I’ve had this same problem start happening from last night. I use the following in my CI pipeline:

firerbase use PROJECTNAME --token $FIREBASE_TOKEN
firebase deploy --only hosting:SITE

I now get the error:

Hosting target SITE not detected in firebase.json

Nothing else has changed on this project or CI defintion for months

Question for you @pflevy -

on v8.12.1, I actually cannot directly do firebase deploy --only hosting:<project-name>. The --only hosting:<target> syntax is actually for deploying to Hosting targets in a multi-site setup. More information on that: https://firebase.google.com/docs/hosting/multisites#cli-commands-with-deploy-targets

Do you have those targets set up and are you using the correct name? I can poke around a bit more, but specifically doing --only hosting:<SITE-name> (which may be the same as the project name) is not supported.