Code Monkey home page Code Monkey logo

firebase-tools's Introduction

Firebase CLI Actions Status Node Version NPM version

The Firebase Command Line Interface (CLI) Tools can be used to test, manage, and deploy your Firebase project from the command line.

  • Deploy code and assets to your Firebase projects
  • Run a local web server for your Firebase Hosting site
  • Interact with data in your Firebase database
  • Import/Export users into/from Firebase Auth

To get started with the Firebase CLI, read the full list of commands below or check out the documentation.

Installation

Node Package

You can install the Firebase CLI using npm (the Node Package Manager). Note that you will need to install Node.js and npm. Installing Node.js should install npm as well.

To download and install the Firebase CLI run the following command:

npm install -g firebase-tools

This will provide you with the globally accessible firebase command.

Standalone Binary

The standalone binary distribution of the Firebase CLI allows you to download a firebase executable without any dependencies.

To download and install the CLI run the following command:

curl -sL firebase.tools | bash

Commands

The command firebase --help lists the available commands and firebase <command> --help shows more details for an individual command.

If a command is project-specific, you must either be inside a project directory with an active project alias or specify the Firebase project id with the -P <project_id> flag.

Below is a brief list of the available commands and their function:

Configuration Commands

Command Description
login Authenticate to your Firebase account. Requires access to a web browser.
logout Sign out of the Firebase CLI.
login:ci Generate an authentication token for use in non-interactive environments.
login:add Authorize the CLI for an additional account.
login:list List authorized CLI accounts.
login:use Set the default account to use for this project
use Set active Firebase project, manage project aliases.
open Quickly open a browser to relevant project resources.
init Setup a new Firebase project in the current directory. This command will create a firebase.json configuration file in your current directory.
help Display help information about the CLI or specific commands.

Append --no-localhost to login (i.e., firebase login --no-localhost) to copy and paste code instead of starting a local server for authentication. A use case might be if you SSH into an instance somewhere and you need to authenticate to Firebase on that machine.

Project Management Commands

Command Description
apps:create Create a new Firebase app in a project.
apps:list List the registered apps of a Firebase project.
apps:sdkconfig Print the configuration of a Firebase app.
projects:addfirebase Add Firebase resources to a Google Cloud Platform project.
projects:create Create a new Firebase project.
projects:list Print a list of all of your Firebase projects.

Deployment and Local Emulation

These commands let you deploy and interact with your Firebase services.

Command Description
emulators:exec Start the local Firebase emulators, run a test script, then shut down the emulators.
emulators:start Start the local Firebase emulators.
deploy Deploys your Firebase project. Relies on firebase.json configuration and your local project folder.
serve Start a local server with your Firebase Hosting configuration and HTTPS-triggered Cloud Functions. Relies on firebase.json.
setup:emulators:database Downloads the database emulator.
setup:emulators:firestore Downloads the firestore emulator.

App Distribution Commands

Command Description
appdistribution:distribute Upload a distribution.

Auth Commands

Command Description
auth:import Batch importing accounts into Firebase from data file.
auth:export Batch exporting accounts from Firebase into data file.

Detailed doc is here.

Realtime Database Commands

Command Description
database:get Fetch data from the current project's database and display it as JSON. Supports querying on indexed data.
database:set Replace all data at a specified location in the current project's database. Takes input from file, STDIN, or command-line argument.
database:push Push new data to a list at a specified location in the current project's database. Takes input from file, STDIN, or command-line argument.
database:remove Delete all data at a specified location in the current project's database.
database:update Perform a partial update at a specified location in the current project's database. Takes input from file, STDIN, or command-line argument.
database:profile Profile database usage and generate a report.
database:instances:create Create a realtime database instance.
database:instances:list List realtime database instances.
database:settings:get Read the realtime database setting at path
database:settings:set Set the realtime database setting at path.

Extensions Commands

Command Description
ext Display information on how to use ext commands and extensions installed to your project.
ext:configure Configure an existing extension instance.
ext:info Display information about an extension by name ([email protected] for a specific version)
ext:install Install an extension.
ext:list List all the extensions that are installed in your Firebase project.
ext:uninstall Uninstall an extension that is installed in your Firebase project by Instance ID.
ext:update Update an existing extension instance to the latest version.

Cloud Firestore Commands

Command Description
firestore:delete Delete documents or collections from the current project's database. Supports recursive deletion of subcollections.
firestore:indexes List all deployed indexes from the current project.

Cloud Functions Commands

Command Description
functions:log Read logs from deployed Cloud Functions.
functions:list List all deployed functions in your Firebase project.
functions:config:set Store runtime configuration values for the current project's Cloud Functions.
functions:config:get Retrieve existing configuration values for the current project's Cloud Functions.
functions:config:unset Remove values from the current project's runtime configuration.
functions:config:clone Copy runtime configuration from one project environment to another.
functions:secrets:set Create or update a secret for use in Cloud Functions for Firebase.
functions:secrets:get Get metadata for secret and its versions.
functions:secrets:access Access secret value given secret and its version. Defaults to accessing the latest version.
functions:secrets:prune Destroys unused secrets.
functions:secrets:destroy Destroy a secret. Defaults to destroying the latest version.
functions:delete Delete one or more Cloud Functions by name or group name.
functions:shell Locally emulate functions and start Node.js shell where these local functions can be invoked with test data.

Hosting Commands

Command Description
hosting:disable Stop serving Firebase Hosting traffic for the active project. A "Site Not Found" message will be displayed at your project's Hosting URL after running this command.

Remote Config Commands

Command Description
remoteconfig:get Get a Firebase project's Remote Config template.
remoteconfig:versions:list Get a list of the most recent Firebase Remote Config template versions that have been published.
remoteconfig:rollback Roll back a project's published Remote Config template to the version provided by --version_number flag.

Use firebase:deploy --only remoteconfig to update and publish a project's Firebase Remote Config template.

Authentication

General

The Firebase CLI can use one of four authentication methods listed in descending priority:

  • User Token - DEPRECATED: this authentication method will be removed in a future major version of firebase-tools; use a service account to authenticate instead - provide an explicit long-lived Firebase user token generated from firebase login:ci. Note that these tokens are extremely sensitive long-lived credentials and are not the right option for most cases. Consider using service account authorization instead. The token can be set in one of two ways:
    • Set the --token flag on any command, for example firebase --token="<token>" projects:list.
    • Set the FIREBASE_TOKEN environment variable.
  • Local Login - run firebase login to log in to the CLI directly as yourself. The CLI will cache an authorized user credential on your machine.
  • Service Account - set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to the path of a JSON service account key file. For more details, see Google Cloud's Getting started with authentication guide.
  • Application Default Credentials - if you use the gcloud CLI and log in with gcloud auth application-default login, the Firebase CLI will use them if none of the above credentials are present.

Multiple Accounts

By default firebase login sets a single global account for use on all projects. If you have multiple Google accounts which you use for Firebase projects you can authorize multiple accounts and use them on a per-project or per-command basis.

To authorize an additonal account for use with the CLI, run firebase login:add. You can view the list of authorized accounts with firebase login:list.

To set the default account for a specific Firebase project directory, run firebase login:use from within the directory and select the desired account. To check the default account for a directory, run firebase login:list and the default account for the current context will be listed first.

To set the account for a specific command invocation, use the --account flag with any command. For example firebase [email protected] deploy. The specified account must have already been added to the Firebase CLI using firebase login:add.

Cloud Functions Emulator

The Cloud Functions emulator is exposed through commands like emulators:start, serve and functions:shell. Emulated Cloud Functions run as independent node processes on your development machine which means they have their own credential discovery mechanism.

By default these node processes are not able to discover credentials from firebase login. In order to provide a better development experience, when you are logged in to the CLI through firebase login we take the user credentials and construct a temporary credential that we pass into the emulator through GOOGLE_APPLICATION_CREDENTIALS. We only do this if you have not already set the GOOGLE_APPLICATION_CREDENTIALS environment variable yourself.

Using behind a proxy

The CLI supports HTTP(S) proxies via environment variables. To use a proxy, set the HTTPS_PROXY or HTTP_PROXY value in your environment to the URL of your proxy (e.g. HTTP_PROXY=http://127.0.0.1:12345).

Using with CI Systems

The Firebase CLI requires a browser to complete authentication, but is fully compatible with CI and other headless environments.

Complete the following steps to run Firebase commands in a CI environment. Find detailed instructions for each step in Google Cloud's Getting started with authentication guide.

  1. Create a service account and grant it the appropriate level of access to your project.
  2. Create a service account key (JSON file) for that service account.
  3. Store the key file in a secure, accessible way in your CI system.
  4. Set GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json in your CI system when running Firebase commands.

To disable access for the service account, find the service account for your project in the Google Cloud Console, and then either remove the key, or disable or delete the service account.

Using as a Module

The Firebase CLI can also be used programmatically as a standard Node module. Each command is exposed as a function that takes positional arguments followed by an options object and returns a Promise.

So if we run this command at our command line:

$ firebase --project="foo" apps:list ANDROID

That translates to the following in Node:

const client = require("firebase-tools");
client.apps
  .list("ANDROID", { project: "foo" })
  .then((data) => {
    // ...
  })
  .catch((err) => {
    // ...
  });

The options object must be the very last argument and any unspecified positional argument will get the default value of "". The following two invocations are equivalent:

const client = require("firebase-tools");

// #1 - No arguments or options, defaults will be inferred
client.apps.list();

// #2 - Explicitly provide "" for all arguments and {} for options
client.apps.list("", {});

Note: when used in a limited environment like Cloud Functions, not all firebase-tools commands will work programatically because they require access to a local filesystem.

firebase-tools's People

Contributors

aalej avatar abeisgoat avatar berlioz avatar bkendall avatar blidd-google avatar christhompsongoogle avatar colerogers avatar elvisun avatar firebase-ops avatar fredzqm avatar google-oss-bot avatar hlshen avatar hsubox76 avatar inlined avatar jamesdaniels avatar jmwski avatar joehan avatar laurenzlong avatar leoortizz avatar lisajian avatar mbleigh avatar ryanpbrewster avatar samtstern avatar ssbushi avatar taeold avatar tamalsaha avatar tinaliang avatar tohhsinpei avatar tonyjhuang avatar yuchenshi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

firebase-tools's Issues

Deployed application uses wrong index.html file

In our app the public directory specified in firebase.json contains several HTML files. The main is called "index.html", the others are "index-full.html" and "facebook-channel.html". After "firebase deploy" the "index-full.html" becomes the default index file and following URLs all load contents of the same file "index-full.html":

If "index-full.html" was renamed to "index-full.html-off", then the correct "index.html" is picked up as the default index file.

npm ERR! during install

I was installing firebase-tools with

$ npm install -g firebase-tools

and all was going well until some npm ERR! at the end. Here is my entire console during installation. Any ideas?

$ sudo npm install -g firebase-tools
npm http GET https://registry.npmjs.org/firebase-tools
npm http 200 https://registry.npmjs.org/firebase-tools
npm http GET https://registry.npmjs.org/firebase-tools/-/firebase-tools-1.1.2.tgz
npm http 200 https://registry.npmjs.org/firebase-tools/-/firebase-tools-1.1.2.tgz
npm http GET https://registry.npmjs.org/prompt
npm http GET https://registry.npmjs.org/when/3.1.0
npm http GET https://registry.npmjs.org/firebase
npm http GET https://registry.npmjs.org/progress
npm http GET https://registry.npmjs.org/tar
npm http GET https://registry.npmjs.org/open
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/fstream-ignore
npm http GET https://registry.npmjs.org/temp
npm http GET https://registry.npmjs.org/optimist
npm http 200 https://registry.npmjs.org/prompt
npm http GET https://registry.npmjs.org/chalk
npm http 200 https://registry.npmjs.org/open
npm http GET https://registry.npmjs.org/prompt/-/prompt-0.2.14.tgz
npm http 200 https://registry.npmjs.org/tar
npm http 200 https://registry.npmjs.org/request
npm http 200 https://registry.npmjs.org/fstream-ignore
npm http 200 https://registry.npmjs.org/temp
npm http 200 https://registry.npmjs.org/progress
npm http 200 https://registry.npmjs.org/prompt/-/prompt-0.2.14.tgz
npm http 200 https://registry.npmjs.org/chalk
npm http GET https://registry.npmjs.org/temp/-/temp-0.6.0.tgz
npm http 200 https://registry.npmjs.org/optimist
npm http 200 https://registry.npmjs.org/firebase
npm http GET https://registry.npmjs.org/progress/-/progress-1.1.8.tgz
npm http GET https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-0.0.10.tgz
npm http GET https://registry.npmjs.org/firebase/-/firebase-1.0.24.tgz
npm http 200 https://registry.npmjs.org/temp/-/temp-0.6.0.tgz
npm http 200 https://registry.npmjs.org/progress/-/progress-1.1.8.tgz
npm http 200 https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-0.0.10.tgz
npm http 200 https://registry.npmjs.org/firebase/-/firebase-1.0.24.tgz
npm http 200 https://registry.npmjs.org/when/3.1.0
npm http GET https://registry.npmjs.org/when/-/when-3.1.0.tgz
npm http 200 https://registry.npmjs.org/when/-/when-3.1.0.tgz
npm http GET https://registry.npmjs.org/strip-ansi
npm http GET https://registry.npmjs.org/has-color
npm http GET https://registry.npmjs.org/ansi-styles
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/osenv/0.0.3
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/fstream
npm http GET https://registry.npmjs.org/minimatch
npm http 200 https://registry.npmjs.org/strip-ansi
npm http 200 https://registry.npmjs.org/ansi-styles
npm http 200 https://registry.npmjs.org/has-color
npm http 200 https://registry.npmjs.org/inherits
npm http 200 https://registry.npmjs.org/minimatch
npm http 200 https://registry.npmjs.org/fstream
npm http 200 https://registry.npmjs.org/rimraf
npm http 200 https://registry.npmjs.org/osenv/0.0.3
npm http GET https://registry.npmjs.org/node-uuid
npm http GET https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/tough-cookie
npm http GET https://registry.npmjs.org/form-data
npm http GET https://registry.npmjs.org/http-signature
npm http GET https://registry.npmjs.org/oauth-sign
npm http GET https://registry.npmjs.org/tunnel-agent
npm http GET https://registry.npmjs.org/hawk
npm http GET https://registry.npmjs.org/aws-sign2
npm http GET https://registry.npmjs.org/forever-agent
npm http GET https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/osenv/-/osenv-0.0.3.tgz
npm http 200 https://registry.npmjs.org/mime
npm http 200 https://registry.npmjs.org/http-signature
npm http 200 https://registry.npmjs.org/node-uuid
npm http 200 https://registry.npmjs.org/form-data
npm http 200 https://registry.npmjs.org/oauth-sign
npm http 200 https://registry.npmjs.org/tunnel-agent
npm http 200 https://registry.npmjs.org/aws-sign2
npm http 200 https://registry.npmjs.org/forever-agent
npm http 200 https://registry.npmjs.org/json-stringify-safe
npm http 200 https://registry.npmjs.org/osenv/-/osenv-0.0.3.tgz
npm http 200 https://registry.npmjs.org/hawk
npm http 200 https://registry.npmjs.org/qs
npm http 200 https://registry.npmjs.org/tough-cookie
npm http GET https://registry.npmjs.org/minimist
npm http GET https://registry.npmjs.org/wordwrap
npm http 200 https://registry.npmjs.org/minimist
npm http 200 https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/faye-websocket
npm http GET https://registry.npmjs.org/utile
npm http GET https://registry.npmjs.org/winston
npm http GET https://registry.npmjs.org/pkginfo
npm http GET https://registry.npmjs.org/read
npm http GET https://registry.npmjs.org/revalidator
npm http GET https://registry.npmjs.org/combined-stream
npm http 200 https://registry.npmjs.org/pkginfo
npm http GET https://registry.npmjs.org/async
npm http 200 https://registry.npmjs.org/read
npm http 200 https://registry.npmjs.org/revalidator
npm http 200 https://registry.npmjs.org/utile
npm http 200 https://registry.npmjs.org/winston
npm http GET https://registry.npmjs.org/block-stream
npm http 200 https://registry.npmjs.org/combined-stream
npm http 200 https://registry.npmjs.org/async
npm http 200 https://registry.npmjs.org/block-stream
npm http GET https://registry.npmjs.org/winston/-/winston-0.8.0.tgz
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http 200 https://registry.npmjs.org/winston/-/winston-0.8.0.tgz
npm http 200 https://registry.npmjs.org/faye-websocket
npm http GET https://registry.npmjs.org/ctype/0.5.2
npm http GET https://registry.npmjs.org/assert-plus/0.1.2
npm http GET https://registry.npmjs.org/asn1/0.1.11
npm http 200 https://registry.npmjs.org/sigmund
npm http GET https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.7.2.tgz
npm http 200 https://registry.npmjs.org/lru-cache
npm http 200 https://registry.npmjs.org/assert-plus/0.1.2
npm http 200 https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.7.2.tgz
npm http GET https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.2.tgz
npm http 200 https://registry.npmjs.org/asn1/0.1.11
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz
npm http 200 https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.2.tgz
npm http GET https://registry.npmjs.org/delayed-stream/0.0.5
npm http GET https://registry.npmjs.org/graceful-fs
npm http 200 https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz
npm http 200 https://registry.npmjs.org/graceful-fs
npm http 200 https://registry.npmjs.org/mkdirp
npm http 200 https://registry.npmjs.org/delayed-stream/0.0.5
npm http GET https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz
npm http 200 https://registry.npmjs.org/graceful-fs
npm http 200 https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz
npm http 200 https://registry.npmjs.org/ctype/0.5.2
npm http GET https://registry.npmjs.org/ctype/-/ctype-0.5.2.tgz
npm http 200 https://registry.npmjs.org/ctype/-/ctype-0.5.2.tgz
npm http GET https://registry.npmjs.org/punycode
npm http GET https://registry.npmjs.org/minimist/0.0.8
npm http GET https://registry.npmjs.org/sntp
npm http GET https://registry.npmjs.org/cryptiles
npm http GET https://registry.npmjs.org/hoek
npm http 200 https://registry.npmjs.org/punycode
npm http GET https://registry.npmjs.org/boom
npm http 200 https://registry.npmjs.org/minimist/0.0.8
npm http GET https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz
npm http 200 https://registry.npmjs.org/sntp
npm http 200 https://registry.npmjs.org/cryptiles
npm http 200 https://registry.npmjs.org/boom
npm http 200 https://registry.npmjs.org/hoek
npm http 200 https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz
npm http GET https://registry.npmjs.org/websocket-driver
npm http 200 https://registry.npmjs.org/websocket-driver
npm http GET https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.3.5.tgz
npm http 200 https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.3.5.tgz
npm http GET https://registry.npmjs.org/mute-stream
npm http GET https://registry.npmjs.org/deep-equal
npm http GET https://registry.npmjs.org/i
npm http GET https://registry.npmjs.org/ncp
npm http 200 https://registry.npmjs.org/mute-stream
npm http 200 https://registry.npmjs.org/deep-equal
npm http 200 https://registry.npmjs.org/i
npm http 200 https://registry.npmjs.org/ncp
npm http GET https://registry.npmjs.org/colors
npm http GET https://registry.npmjs.org/cycle
npm http GET https://registry.npmjs.org/stack-trace
npm http GET https://registry.npmjs.org/eyes
npm http 200 https://registry.npmjs.org/colors
npm http 200 https://registry.npmjs.org/cycle
npm http 200 https://registry.npmjs.org/stack-trace
npm http 200 https://registry.npmjs.org/eyes
/usr/bin/firebase -> /usr/lib/node_modules/firebase-tools/bin/firebase
npm ERR! peerinvalid The package generator-karma does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants generator-karma@>=0.8.2

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "firebase-tools"
npm ERR! cwd /home/max
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code EPEERINVALID
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/max/npm-debug.log
npm ERR! not ok code 0

Error after installation

/usr/local/lib/node_modules/firebase-tools/lib/app.js:146
  });
   ^
SyntaxError: Unexpected token )
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/firebase-tools/bin/firebase:15:11)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

Cannot choose an app on windows

On firebase init, I cannot select an existing app from the terminal, even if it displays my existing apps (select in the means of using arrow keys)

Deploying with --token flag fails in Travis-CI

Following the instructions in the README for v2, I've been unable to successfully deploy via Travis.

In my Travis repo settings I've set FIREBASE_TOKEN with the output from firebase prefs:token, and in my travis.yml I've replaced this:

after_success:
  firebase deploy --email ${FIREBASE_EMAIL} --password ${FIREBASE_PASSWORD}

with this:

after_success:
  firebase deploy --token "${FIREBASE_TOKEN}"

But the deploy fails with:

Error: Command requires authentication, please run firebase login

What am I missing?

--token still does not work

I see that commit 13a102e tried to fix the --token issue but i still can't get the command to work

Using the following command
"firebase deploy --token " without the keeps giving an error "Error: Authentication Required"

I login successfully using "firebase login" and then run "firebase prefs:token" which runs successfully and returns a token that i tried using with and without the leading hyphen.

I tried installing firebase-tools directly from "npm install firebase-tools" and also trying to manually copying the github repo and using that as well and both continue to fail.

"firebase --version" returns 2.0.2 and am running the commands using git bash on a Windows 8.1 laptop. I am running node version 4.1.0 and npm version 2.14.3

Line lengths in concatenated Javascript files exceed 32K

During the deployment multiple Javascript files referenced from the index.html get concatenated to a single Javascript file if the <script> tags follow each other. The concatenated Javascript file contains a line longer than 32K, as shown by the following awk output:

awk '{print length}' .tmp/33286eca407d88980ae3d2a87c81c1fb87d7c5df.js
32116
32075
32006
32161
32053
32089
32031
32012
32035
32059
32034
32084
**36677**
32005
32057
32086
32019
32016
32093
32038
32036
32362
32755

Script with lines over 32K couldn't be loaded by the browser (Chrome, Firefox).

command to update version?

thanks for the version bump, but how do I update?

error: OUTDATED CLI VERSION - Please update to at least v0.2.0

sudo npm update -g still keeps me at version 0.1.6

importing firebase-tools in gulp makes tasks hang

It looks like if I import { deploy } from 'firebase-tools' or require('firebase-tools') in my gulp file, any tasks I start it seems to be hanging after it's done and it never exists.

You can check it on Travis by looking at one of my failed builds. If you look at what changed from the previous versions you can see that I've added firebase tools to manage the deployments to Firebase.

Rules output

When deploying firebase rules, the output becomes one single line and as a result I'm getting the error:
Error: Rules Syntax Error: 1:12909: Unknown variable '$userid'.
1:12878: Unknown variable '$userid'.
1:11999: Unknown variable '$userid'.
1:11968: Unknown variable '$userid'.

Also on the Firebase website it just shows as a single line which isn't very ideal for readability...

Error during installation

bash-3.2# npm install -g firebase-tools
npm ERR! Darwin 12.3.0
npm ERR! argv "node" "/Users/manishsivanandan/local/bin/npm" "install" "-g" "firebase-tools"
npm ERR! node v0.10.29
npm ERR! npm v2.0.2
npm ERR! file /Users/manishsivanandan/.npm/minimatch/0.3.0/package/package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected end of input
npm ERR! File: /Users/manishsivanandan/.npm/minimatch/0.3.0/package/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

Feature request: gulp wrapper for firebase-tools

Would like to be able to pipe rules that are transpiled from either blaze (there is already a gulp wrapper for the blaze compiler) or butane to a firebase deploy task.

Considering these are already cli tasks this maybe possible today (by using exec in the gulpfile), but tasks such as login I think require input at the command line rather than accept arguments, making this tougher than just something like exec('firebase loginusername password').

FIREBASE_TOKEN env var support

Hi there,

Glad to see the 2.0 update brought token auth - but I just noticed that when running firebase deploy as an npm-script without the -s (silent) flag, an error will cause the token to be printed to stderr. This is not great - I was wondering if it would be possible to add built-in support for the suggested FIREBASE_TOKEN env var, rather than having to pass --token "${FIREBASE_TOKEN}".

don't show a progress bar when running in --non-interactive

running firebase --non-interactive --token "$FIREBASE_TOKEN" deploy errors in my ci. (gitlab ci)

FIREBASE WARNING: Exception was thrown by user callback. TypeError: this.stream.clearLine is not a function
    at ProgressBar.terminate (/cache/project-www/node_modules/firebase-tools/node_modules/progress/lib/node-progress.js:177:17)
    at ProgressBar.tick (/cache/project-www/node_modules/firebase-tools/node_modules/progress/lib/node-progress.js:91:10)
    at /cache/project-www/node_modules/firebase-tools/lib/deploy/hosting/deploy.js:49:15
    at /cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:46:642
    at Bb (/cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:43:165)
    at xb (/cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:22:216)
    at yb (/cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:21:1260)
    at Yh.g.Eb (/cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:206:287)
    at Kh.g.Gd (/cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:193:283)
    at yh.Gd (/cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:183:364) 

Error: An unexpected error has occurred.
✔  2015 files uploaded successfully
FIREBASE WARNING: Exception was thrown by user callback. TypeError: this.stream.clearLine is not a function
    at ProgressBar.terminate (/cache/project-www/node_modules/firebase-tools/node_modules/progress/lib/node-progress.js:177:17)
    at /cache/project-www/node_modules/firebase-tools/lib/deploy/hosting/deploy.js:54:15
    at /cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:46:642
    at Bb (/cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:43:165)
    at xb (/cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:22:216)
    at yb (/cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:21:1260)
    at Yh.g.Eb (/cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:206:287)
    at Kh.g.Gd (/cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:193:283)
    at yh.Gd (/cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:183:364)
    at qh.xg (/cache/project-www/node_modules/firebase-tools/node_modules/firebase/lib/firebase-node.js:181:281) 

Earlier progress notification

So I recently upgraded to 2.0 and now I can't deploy my app! My node version is v0.12.7 and I have successfully authenticated into my account [email protected] on an account that has a spark plan.

Here's my firebase.json file

{
  "firebase": "easy-pledge",
  "public": ".",
  "ignore": [
    "firebase.json",
    "**/.*",
    "**/node_modules/**",
    "*.iml",
    "__excluded"
  ],
  "redirects":[{
    "source": "/",
    "destination": "/landing/",
    "type": 301
  }]
}

and here's the console output when I run firebase deploy --debug

----------------------------------------------------------------------
Command:      node /usr/local/bin/firebase deploy --debug
Platform:     darwin
Node Version: v0.12.7
Time:         Tue Dec 01 2015 17:45:35 GMT-0700 (MST)
----------------------------------------------------------------------

>>> HTTP REQUEST GET https://admin.firebase.com/firebase/easy-pledge/token?token=XXX 
<<< HTTP RESPONSE 200 server=nginx, date=Wed, 02 Dec 2015 00:45:35 GMT, content-type=application/json; charset=utf-8, content-length=471, connection=close, access-control-allow-origin=*, access-control-allow-methods=GET, PUT, POST, DELETE, OPTIONS, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
>>> HTTP REQUEST GET https://admin.firebase.com/firebase/easy-pledge/token?token=XXX 
<<< HTTP RESPONSE 200 server=nginx, date=Wed, 02 Dec 2015 00:45:35 GMT, content-type=application/json; charset=utf-8, content-length=471, connection=close, access-control-allow-origin=*, access-control-allow-methods=GET, PUT, POST, DELETE, OPTIONS, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store

=== Deploying to 'easy-pledge'...

i  deploying hosting
i  preparing . directory for upload...
>>> HTTP REQUEST PUT https://deploy.firebase.com/firebase/easy-pledge/uploads/-K4V8hKHCSWh44IVAIt9?token=XXX&fileCount=168&message= 

Once it gets to this point it just hangs, forcing me to cmd + c to escape.

Help! What's going wrong?

Add support for login by parameter

Something like: firebase deploy --user=user --password=pass

It's very useful in a Continuos Delivery Environment for example,

Is it possible? Or maybe something more robust like private keys or certificates...

Automatic deploy to hosting with API

I have so much struggle with this, especially authentication part. When I login with firebase login, then I can grab token from firebase prefs:token. However once I run firebase logout, this token becomes invalid and cannot be used anymore. If I am about to use this token in the config for deployment tool, I am not even sure if this token can expire eventually.

I am wondering if there is some other way how to obtain the token without this manual step and relying on some expiration time. I tried to use firebase-token-generator to create token which creates nice JWT token, but I am not sure how to use that token for hosting deployment. Passing it to token option gives me error from remote server: {"error":{"code":"AUTHENTICATION_REQUIRED","message":"Authentication required."}}

AngularFire seed config.js simple fix

There is a small problem with the bootstrap command and the Angular seed template.
When modifies the "configRegex" key (/lib/app.js) in the file app/js/config.js of the template. The hostname is replaced 2 times.
What finally confused when we making the deploy because it requires changing the hostname when no longer needed:

config-js

Cannot deploy symlinks

When I had symlinks in my deploy target directory I got the error.

$ firebase deploy
Preparing to deploy Public Directory...

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: Didn't get expected byte count
expect: 33
actual: 4975
    at decorate (/usr/local/lib/node_modules/firebase-tools/node_modules/fstream-ignore/node_modules/fstream/lib/abstract.js:67:36)
    at FileReader.Abstract.error (/usr/local/lib/node_modules/firebase-tools/node_modules/fstream-ignore/node_modules/fstream/lib/abstract.js:61:12)
    at ReadStream.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/fstream-ignore/node_modules/fstream/lib/file-reader.js:66:10)
    at ReadStream.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

I replaced those symlinks with copied regular files, then the error resolved.
It is great that firebase deploy can handle symlinks kindly.

The version of firebase-tools are installed via npm.

$ firebase
Firebase Command Line Tools
Version 1.0.4

firebase init issue

Hi
I have problem when i run firebase init in Terminal showed me this message

Initialization Warning - Creating new firebase app inside a non-empty directory.
Initialization Error - Can't create new firebase app inside an existing firebase project

any idea to help

Retrieve application secret of new created firebase

Is it possible to retrieve the application secret after creating a new firebase via firebase init as a return value? We need to store the application secret in another database without a manual copy step from the Web page.
Or is it possible to set or get the application secret programmatically?

Thanks

Use hosting with prerender.io

Hi

I'm wondering whether there's a way to use Firebase hosting in conjunction with a service like prerender.io?
This way it would be possible to deploy a webapp (i.e. angularjs app) with SEO capabilities.

Thanks

Doesn't Deploy

Hello,
I'm running Windows 7 with node 0.8.7 and firebase 0.2.0
If I create a new folder bootstrap, init then deploy all I get is;

c:\new>firebase deploy
Deploying...

c:\new>

Then i'm returned to the command. Can you add more logging to see if it is failing on the tar creation or the upload. Maybe log out the paths/urls?

Thanks

Error when replacing stylesheet paths if there is a cache-bursting parameter

Hi,

here are the stylesheets included from my index.html before deploying to Firebase Hosting:

<link rel="stylesheet" href="vendor/bootstrap/dist/css/bootstrap.min.css?bust=v0.0.0">
<link rel="stylesheet" href="vendor/bootstrap/dist/css/bootstrap-theme.min.css?bust=v0.0.0">
<link rel="stylesheet" href="assets/css/main.css?bust=v0.0.0">

After deploying, they are replaced by:

<link rel="stylesheet" href="https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackcdn.com/js/2d14ab97cc3dc294c51c0d6814f4ea45f4b4e312/jquery-1.11.0.min">
<link rel="stylesheet" href="https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackcdn.com/js/2d14ab97cc3dc294c51c0d6814f4ea45f4b4e312/jquery-1.11.0.min">
<link rel="stylesheet" href="https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackcdn.com/js/2d14ab97cc3dc294c51c0d6814f4ea45f4b4e312/jquery-1.11.0.min">

If I remove the cache-busting parameter, here is the (correct) result:

<link rel="stylesheet" href="https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackcdn.com/css/879ea1647b03cdf739ec8564b53100a4e40110e5/vendor/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackcdn.com/css/f5fb370c8810406e41e8dfefcaa55813e85351b5/vendor/bootstrap/dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackcdn.com/css/2e1a5e3bc55c2124040f816bd882a4ab126077b5/assets/css/main.css">

My build process is now removing the cache bursting parameter, but you might want to have a look into this anyway.

Thanks for this beta btw, this is great to be able to easily manage backend and hosting in the same place.

Having issue with deploy

Progress hangs up after deploying few files.

Preparing to deploy Public Directory...
progress: 43%Deploy Error - socket hang up

Preparing to deploy Public Directory...
progress: 14%Deploy Error - read ECONNRESET

Double `rules` Key when using `.bolt` Rules

Firebase Tools 2.1.0
Firebase Bolt v0.5.0

Deploying via command line using firebase deploy:rules and specifying a .bolt rule file in my firebase.json. The rules that get set on my app contains a duplicate rules key, like so

{
  "rules": {
    "rules": {
       // my correct rules here
    }
  }
}

Question Deployment limits?

Is there a limit to how often you can deploy? I deployed a couple times yesterday and now I am unable to deploy.

My firebase is a hacker account.

error while installing on windows

npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected token '\u0000' at 1:1
npm ERR!

npm ERR! ^
npm ERR! File: C:\Users~\AppData\Roaming\npm-cache\inherits\2.0.1\package\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

angular template has issues.

Enter the name of the Firebase app you would like to use for hosting
Firebase app: awareco

Available Templates

angular - The AngularFire seed template
backbone - Example to-do app using BackFire
chat - A realtime multi-person chat client with JavaScript, HTML, and CSS
drawing - Share a canvas and collaboratively draw with other users
ember - Example blog built with EmberFire
firechat - A more fully-featured chat widget using Firechat
firepad - Collaborative text editing with Firepad
ionic - A small chatroom application written for Ionic
leaderboard - A leaderboard which keeps track of high scores in realtime
presence - Show who is available, who is idle, and who is gone
react - Example to-do app using ReactFire
tetris - Play head-to-head Tetris in your browser

Choose a template to help you get started with your app
Template: angular
Bootstrapping into directory 'awareco'...
Downloading and unpacking template...
Initialization Error - Couldn't update template with project settings

Not sure why the angular template is having problems, please help.

firebase as module

Hi. I would like to use firebase list as a module to retrieve a list/array of database ids. Could someone give me a hint how to do that?

Thanks in advance!
dominik

Allow for custom app templates

When you firebase init, after you authenticate and select your Firebase, you’re asked to pick a template of these 2: angular and chat. I’m wondering if it would be possible to have none as a template option? For example I have my app that is structured in my own way and I just want to publish a specific set of static files — including an index.html — to my firebaseapp.com.

cannot login

When I try to use Firebase Login through CLI,
it says
Error: Cannot run login in non-interactive mode. Pass --token instead.

This is a newly installed PC. In my old PC, I could use firebase CLI.
In my newly installed PC, after installing firebase-tools, I tried to login using the command

firebase login

But instead got the error above.

Add method to get list of deploy messages

I like to include a deploy message with every deploy that aims to encapsulate the changes that an average user of my application can understand. It would be great if there were a way to get all the deploy messages from the currently deployed (non-rollback) pushes, so I can easily roll them into a change log or release notes.

Currently, I have to intercept the messages and write them to disk, store them in version control, merge with other user others... not great. I'm envisioning something similar to what you can do already in git: git log --oneline --decorate which is great for developers--not so much for users.

Javascript API?

Hey guys,

Any chance you'd be willing to think about having this library expose a javascript api for other platforms to be able to deploy programmatically? It seems like all the work to get this done is more or less in place, it would just need to be polished a bit and exposed through the module.

💖

EDIT: I see some pieces of what might be a javascript api here - based on the firebase npm module (not on github? 😕), it seems like it might be possible?

Github Login Support

I'd love to play around with Firebase hosting, but my Firebase account uses my Github and I have no way to log in with this app. I understand this may be difficult, so alternatively, if we could "login" to an individual Firebase by providing the Firebase's secret that may suffice for now.

Otherwise great work, can't wait to play with this!

firebase deploy butchers angularjs view templates that reference scope data

I am moving an angularJS app over to firebase deploy and I noticed my templates break because the angularJS parser is choking on encoded entities:

Example:
in my src template, I am using angularfire "orderByPriority" filter to order my list in ng-repeat:

 <tr ng-repeat="data in list | orderByPriority">
            <td><a href='#/requisitions/{{data.$id}}/applications'>{{data.title}}</a></td>
            ...

and the href attribute turns into:

href="#/requisitions/{{req.%24id}}"

which causes the compiler to log to the console:

Error: [$parse:syntax] Syntax Error: Token 'id' is an unexpected token at column 8 of the expression [req.NaNd] starting at [id].

I can write my own orderByPriority filter that doesn't implement special tokens and work around this problem, but it would be great if the deploy didn't encode ALL the entities in my templates. I would prefer it wouldn't touch my template at all. Can you create an deploy level or project level flag to either turn this off or tone it down some?

Love the product by the way, thanks!!

silent the progress log

Is there a way to silent the progress log when the deploy is happening? It just looks very weird when I use it on Travis.

How to store result of data:get inside javascript variable

Using firebase-tools data:get the result is being printed out to the console or to a given file. I would like to use this command as a module inside javascript and to store the result in a variable. Is this possible? If yes, how?

Thanks in advance

Doesn't work with Node v4.1

If I use nvm to use node 0.12.1, then firebase-tools work. But if I set nvm to use v4.1 then when I firebase deploy I get a hung cli as if it is waiting for something. I have to ctrl-c to get out.

Help text for `firebase deploy` does not list `--token` or `--json` options

When I run firebase help deploy, the output (following) does not mention the new options.

  Usage: deploy [options]

  deploy hosting assets and rules for the current app

  Options:

    -h, --help               output usage information
    -f, --firebase <app>     override the app specified in firebase.json
    -m, --message <message>  an optional message describing this deploy

Ignore specific files on deploy

It would be nice to have an option in firebase.json to ignore specific files on deploy. My app now is in a git repository, and firebase deploy pushed everything including my .git directory, which was surprising.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.