Firebase-tools: Firebase.json deploy includes hidden folder files beginning with dot ' . '

Created on 22 Jan 2018  Â·  6Comments  Â·  Source: firebase/firebase-tools

Version info

3.7.13

Steps to reproduce

$ git clone // adds 15 hidden files and folders to a local machine

Before git clone firebase deploy, deploys 7 files for my simple firebase web hosting
After git clone firebase deploy, deploys 22 files for my simple firebase web hosting.

$ firebase init generates
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"/.*",
"
/node_modules/"
],
"rewrites": [
{
"source": "
",
"destination": "/index.html"
}
]
}
}

$ firebase deploy

deploys 14 hidden .git files and folders from local machine to firebase hosting including any secret files.

Expected behavior

$ firebase deploy should ignore .git hidden files.

Actual behavior

Project Console: https://console.firebase.google.com/project/cliveboulton-0000001/overview
Hosting URL: https://cliveboulton-0000001.firebaseapp.com
Clives-MBP:shiny-octo-telegram seebe$ clear

Clives-MBP:shiny-octo-telegram seebe$ firebase deploy --debug
[2018-01-22T04:22:26.332Z] ----------------------------------------------------------------------
[2018-01-22T04:22:26.336Z] Command: /usr/local/Cellar/node@6/6.12.3/bin/node /usr/local/bin/firebase deploy --debug
[2018-01-22T04:22:26.337Z] CLI Version: 3.17.3
[2018-01-22T04:22:26.337Z] Platform: darwin
[2018-01-22T04:22:26.337Z] Node Version: v6.12.3
[2018-01-22T04:22:26.338Z] Time: Sun Jan 21 2018 20:22:26 GMT-0800 (PST)
[2018-01-22T04:22:26.338Z] ----------------------------------------------------------------------

[2018-01-22T04:22:26.352Z] > 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"]
[2018-01-22T04:22:26.353Z] > authorizing via signed-in user
[2018-01-22T04:22:26.355Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/cliveboulton-0000001

Sun Jan 21 2018 20:22:26 GMT-0800 (PST)
[2018-01-22T04:22:26.853Z] <<< HTTP RESPONSE 200 server=nginx, date=Mon, 22 Jan 2018 04:22:26 GMT, content-type=application/json; charset=utf-8, content-length=135, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
[2018-01-22T04:22:26.855Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/cliveboulton-0000001/tokens

Sun Jan 21 2018 20:22:26 GMT-0800 (PST)
[2018-01-22T04:22:27.524Z] <<< HTTP RESPONSE 200 server=nginx, date=Mon, 22 Jan 2018 04:22:27 GMT, content-type=application/json; charset=utf-8, content-length=271, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store

=== Deploying to 'cliveboulton-0000001'...

i deploying hosting
i hosting: preparing public directory for upload...
[2018-01-22T04:22:28.058Z] >>> HTTP REQUEST PUT https://deploy.firebase.com/v1/hosting/cliveboulton-0000001/uploads/-L3R5aSLGH1pUpznB6DK?fileCount=22&message=

Sun Jan 21 2018 20:22:28 GMT-0800 (PST)
[2018-01-22T04:22:29.059Z] <<< HTTP RESPONSE 200 server=nginx, date=Mon, 22 Jan 2018 04:22:28 GMT, content-type=application/json; charset=utf-8, content-length=49, connection=close, access-control-allow-origin=, access-control-allow-methods=GET, PUT, POST, DELETE, OPTIONS, strict-transport-security=max-age=31556926; includeSubDomains; preload, x-content-type-options=nosniff
[2018-01-22T04:22:29.060Z] [hosting] .tgz uploaded successfully, waiting for extraction
✔ hosting: 22 files uploaded successfully
[2018-01-22T04:22:29.882Z] >>> HTTP REQUEST POST https://deploy.firebase.com/v1/projects/cliveboulton-0000001/releases
{ hosting:
{ public: 'public',
ignore: [ 'firebase.json', '/.
', '/node_modules/*' ],
rewrites: [ [Object] ],
version: '-L3R5aSLGH1pUpznB6DK',
prefix: '-L3R5aSLGH1pUpznB6DK/',
manifest: [] } }
Sun Jan 21 2018 20:22:29 GMT-0800 (PST)
[2018-01-22T04:22:30.697Z] <<< HTTP RESPONSE 200 server=nginx, date=Mon, 22 Jan 2018 04:22:30 GMT, content-type=application/json; charset=utf-8, content-length=34, connection=close, access-control-allow-origin=
, access-control-allow-methods=GET, PUT, POST, DELETE, OPTIONS, strict-transport-security=max-age=31556926; includeSubDomains; preload, x-content-type-options=nosniff

✔ Deploy complete!

#

Appears related to PR to fix https://github.com/firebase/firebase-tools/pull/381

All 6 comments

I'm unable to reproduce this problem myself. Can you send an archive of the folder contents to bleigh (at) google or publicly post an archive with a minimal repro of the problem?

I shared a folder via gdrive with link mailed to bleigh. Thx for taking a look.

The problem appears to be with hidden folders as opposed to files. I'm currently unable to figure out a glob pattern that matches this correctly, but the following does work:

{
  "hosting": {
    "ignores": [
      "**/.git/**",
      "**/.*"
    ]
  }
}

That will ignore the .git directory and also any hidden files that start with ..

"ignores" was probably unintended. Set as "ignore" only syncs required project files to Firebase:

@mbleigh The default ignore is node_modules only. May I suggest to add .git to this? The glob pattern is not necessary, just plain folder name works for me (1000x works, the upload size went from 57MB to 56KB, lol).

It just improves user experience, imho, as a lot of users may consider these astronomical upload sizes a norm and as they develop the code the upload grows and then all of a sudden stops working. It's quite hard to figure out why the upload is so huge, I had to insert console.log() into the code above to list the files. I believe there are tons of people around playing with firebase functions who unknowingly upload megabytes of their precious git history onto Google infrastructure for no reason :-)

Here's my ignore list for everybody's copy-pasting pleasure:

    "ignore": [
      ".git",
      "node_modules",
      "src",
      ".eslintrc.json",
      ".firebaserc",
      ".gitattributes",
      ".gitignore",
      ".gitmodules",
      "README.md",
      "firebase.json",
      "rollup.js",
      "tsbuild.json",
      "tsconfig.json",
      "tslint.json"
    ]

src is there, because I write in TS, and then compile and rollup into a single lib/index.js which is getting deployed.

Was this page helpful?
0 / 5 - 0 ratings