Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #1523 #1567

Merged
merged 6 commits into from
Jul 30, 2019
Merged

Fix issue #1523 #1567

merged 6 commits into from
Jul 30, 2019

Conversation

samtstern
Copy link
Contributor

Description

Depends on #1564
Fixes #1523

Scenarios Tested

Functions

const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();

exports.helloWorld = functions.https.onRequest(async (request, response) => {
 
    await admin.database().ref('test/test1').set({ hello: 'world '});
    await admin.database().ref('test/test2').set({ hello: 'other' });

    response.send("Hello from Firebase!");
});

exports.databaseOne = functions.database.ref('test/test1').onWrite((change, ctx) => {
    console.log('DB1');
    return true;
});

exports.databaseTwo = functions.database.ref('test/test2').onWrite((change, ctx) => {
    console.log('DB2');
    return true;
});

Got this result when calling helloWorld:

$ npx firebase emulators:start
i  Starting emulators: ["functions","database"]
⚠  Your requested "node" version "8" doesn't match your global version "10"
✔  functions: Emulator started at http://localhost:5001
i  database: Emulator logging to database-debug.log
✔  database: Emulator started at http://localhost:9000
i  database: For testing set FIREBASE_DATABASE_EMULATOR_HOST=localhost:9000
i  functions: Watching "/tmp/tmp.ddVISM2wPN/functions" for Cloud Functions...
✔  functions[helloWorld]: http function initialized (http://localhost:5001/fir-dumpster/us-central1/helloWorld).
✔  functions[databaseOne]: database function initialized.
✔  functions[databaseTwo]: database function initialized.
✔  All emulators started, it is now safe to connect.
i  functions: Beginning execution of "helloWorld"
i  functions: Finished "helloWorld" in ~1s
i  functions: Beginning execution of "databaseTwo"
i  functions: Beginning execution of "databaseOne"
>  DB1
i  functions: Finished "databaseOne" in ~1s
>  DB2
i  functions: Finished "databaseTwo" in ~1s

Sample Commands

N/A

@googlebot googlebot added the cla: yes Manual indication that this has passed CLA. label Jul 30, 2019
@samtstern samtstern requested a review from jmwski July 30, 2019 17:52
@bkendall
Copy link
Contributor

You'll want to sync your branch w/ master locally on your machine. changelog.txt has been renamed to CHANGELOG.md, so your entry will just have to be moved.

CHANGELOG.md Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jul 30, 2019

Coverage Status

Coverage remained the same at 63.942% when pulling 9f71df2 on ss-fix-1523 into 936a15d on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Manual indication that this has passed CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Functions emulator only maintaining last realtime database trigger
5 participants