Hosting: How to deploy multiple directories?

725 views
Skip to first unread message

Marko

unread,
Sep 20, 2022, 3:32:42 PM9/20/22
to Firebase Google Group
How to deploy multiple directories to firebase hosting? The deployment of multiple directories to firebase hosting fails.

In my firebase.json I define two directories:    "public": ["public", "config/gcp_tst"]

In the emulator the deployment is OK but the deployment to my firebase project fails.

firebase emulators:start --only hosting:gcp_tst
is OK

firebase deploy --debug --only hosting:gcp_tst
fails with error


TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Array
    at new NodeError (node:internal/errors:372:5)
    at validateString (node:internal/validators:120:11)
    at Object.resolve(node:path:1098:7)
    at resolveProjectPath (/usr/local/lib/node_modules/firebase-tools/lib/projectPath.js:14:17)
    at validateDeploy (/usr/local/lib/node_modules/firebase-tools/lib/deploy/hosting/validate.js:23:92)
    at prepare (/usr/local/lib/node_modules/firebase-tools/lib/deploy/hosting/prepare.js:31:39)
    at processTicksAndRejections(node:internal/process/task_queues:96:5)
    at async chain (/usr/local/lib/node_modules/firebase-tools/lib/deploy/index.js:32:9)
    at async deploy (/usr/local/lib/node_modules/firebase-tools/lib/deploy/index.js:67:5)


my firebase.json

{
  "hosting": [
    {
      "target": "gcp_tst",
      "public": ["public", "config/gcp_tst"],
      "ignorance": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
      ]
    }
]
}

Michael Bleigh

unread,
Sep 20, 2022, 3:43:52 PM9/20/22
to Firebase Google Group
Multiple public directories are not supported. You'll need to have a build process that puts all of the files you want in the same directory before deploying. The fact that it works in emulation is a quirk of the library underlying the emulator (and should probably be corrected).

Hope that helps!
Michael

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/86f9217b-8730-4004-a0fd-9decf22aee13n%40googlegroups.com.
Message has been deleted

Marko

unread,
Sep 22, 2022, 11:00:04 AM9/22/22
to Firebase Google Group
Thank you for your help.

I have created multiple targets in my firebase.json file and that gives me the functionality I needed.

Op dinsdag 20 september 2022 om 22:47:15 UTC+2 schreef m...@jfhr.de:
If you want to create multiple sites, follow this documentation: 


Tl;dr you have to create several sites in the "hosting" section in firebase.json, each site deploys from one folder.

You can't use multiple folders for the same site though.

On 20. Sep 2022, at 21:32, Marko <m....@avics.nl> wrote:


--
Reply all
Reply to author
Forward
0 new messages