Pull request Compare This branch is 6 commits ahead, 143 commits behind Node-8.
nicolasgarnier Upgrade all firebase-admin imports to 5.11.0
Change-Id: Ib3f6a5f57d3fdd0dbc2ee3d27efbd3cf00966257
Latest commit 849ab0b Mar 26, 2018
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
functions
README.md Update README.md Dec 12, 2017
firebase.json Add a pubsub quickstart sample with import tags. Jan 26, 2017

README.md

Firebase SDK for Cloud Functions Quickstart - PubSub trigger

This quickstart demonstrates how to setup a PubSub triggered Cloud Function using the Firebase SDK for Cloud Functions.

Introduction

We'll deploy a PubSub triggered Functions that prints out a Hello World message to the Cloud Logs.

Further reading:

Initial setup, build tools and dependencies

1. Clone this repo

Clone or download this repo and open the quickstarts/pubsub-helloworld directory.

2. Create a Firebase project and configure the quickstart

Create a Firebase Project on the Firebase Console.

Set up your Firebase project by running firebase use --add, select your Project ID and follow the instructions.

3. Install the Firebase CLI and enable Functions on your Firebase CLI

You need to have installed the Firebase CLI. If you haven't run:

npm install -g firebase-tools

Doesn't work? You may need to change npm permissions.

Deploy the app to prod

First you need to install the npm dependencies of the functions:

cd functions && npm install; cd ..

This installs locally the Firebase Admin SDK and the Firebase SDK for Cloud Functions.

Deploy to Firebase using the following command:

firebase deploy

This deploys and activate the PubSub hello World Functions.

The first time you call firebase deploy on a new project with Functions will take longer than usual.

Try the sample

Once deployed, to try the sample use the gcloud CLI to publish a message to the topic-name topic:

gcloud alpha pubsub topics publish topic-name --message='YourName'

Open the Functions logs in the Firebase Console, you should see a messages that reads "Hello YourName".

Then you can also publish a message to the another-topic-name topic using JSON data:

gcloud alpha pubsub topics publish another-topic-name --message='{"name":"YourName"}'

Open the Functions logs in the Firebase Console, you should see a messages that reads "Hello YourName".

Last you can also publish a message to the yet-another-topic-name topic using JSON data:

gcloud alpha pubsub topics publish yet-another-topic-name --attribute name=YourName

Open the Functions logs in the Firebase Console, you should see a messages that reads "Hello YourName".

Contributing

We'd love that you contribute to the project. Before doing so please read our Contributor guide.

License

© Google, 2016. Licensed under an Apache-2 license.