Firebase-tools: hosting:channel:deploy: Hosting configs should only include either "site" or \"target\", not both.

Created on 27 Oct 2020  ·  3Comments  ·  Source: firebase/firebase-tools

I have a multisite config with targets. Using npx firebase-tools deploy --only hosting or npx firebase-tools deploy --only hosting:bbbb works fine. But if I use the new GitHub action, it fails on the line:

 /usr/local/bin/npx firebase-tools hosting:channel:deploy pr22-blah --expires 30d --project blah-dev --json

Running the same thing locally fails in the same way. The error is:

$ npx firebase-tools hosting:channel:deploy pr22-blah --only bbb --expires 30d --project blah-dev --json
{
  "status": "error",
  "error": "Hosting configs should only include either \"site\" or \"target\", not both."
}

Note that the command I used there adds --only bbb. The command fails the same way with or without that.

Also note that my firebase.json does NOT list "site" at all. See below:

.firebaserc:

{
  "projects": {
    "default": "blah-dev",
    "dev": "blah-dev",
    "prod": "blah-io"
  },
  "targets": {
    "blah-io": {
      "hosting": {
        "aaa": [
          "blah-aaa"
        ],
        "boilerplate": [
          "blah-boilerplate"
        ],
        "bbb": [
          "blah-bingo"
        ]
      }
    },
    "blah-dev": {
      "hosting": {
        "aaa": [
          "blah-aaa-dev"
        ],
        "boilerplate": [
          "blah-boilerplate-dev"
        ],
        "bbb": [
          "blah-bbb-dev"
        ]
      }
    }
  }
}

firebase.json

{
  "firestore": {...},
  "database": {...},
  "functions": {...},
  "hosting": [
    {
      "target": "aaa",
      "public": "packages/aaa/build",
      "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
      ],
      "rewrites": [
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
    },
    {
      "target": "boilerplate",
      "public": "packages/boilerplate/build",
      "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
      ],
      "rewrites": [
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
    },
    {
      "target": "bbb",
      "public": "packages/bbb/build",
      "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
      ],
      "rewrites": [
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
    }
  ],
  "emulators": {...}
}

[REQUIRED] Environment info

firebase-tools:. npx firebase-tools --version -> 8.14.0

Platform: OSX, but also GitHub Actions default image

[REQUIRED] Test case

See above.

[REQUIRED] Steps to reproduce

See above. Run the hosting:channel:deploy command

[REQUIRED] Expected behavior

It deploys

[REQUIRED] Actual behavior

{
  "status": "error",
  "error": "Hosting configs should only include either \"site\" or \"target\", not both."
}

(--debug flag adds a lot of HTTP logging noise at the front, but it's all 200s.)

Most helpful comment

Thanks for the report. I've got a fix out and will get it out ASAP.

All 3 comments

Thanks for the report. I've got a fix out and will get it out ASAP.

I'm getting this error when not using channel but just firebase deploy --only hosting:. I'm running it on gitlab runner where I have site and target by branch name
firebase deploy --only hosting:$CI_COMMIT_REF_SLUG -m "Tag $TAG Pipeline $CI_PIPELINE_ID, build $CI_BUILD_ID" --non-interactive

@Mistic92 please open a new issue with more details and reproduction steps.

Was this page helpful?
0 / 5 - 0 ratings