question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Functions emulator only maintaining last realtime database trigger

See original GitHub issue

[REQUIRED] Environment info

firebase-tools: firebase: 7.1.1 node: v10.16.0 java: 11.0.2

Platform: macOS

[REQUIRED] Test case

It appears at this line, firebase-tools/functionsEmulator.ts at dad143c42445056014f6f48cc9dfa13156e3c186 · firebase/firebase-tools · GitHub , the request to add a new trigger is overriding the previous triggers added rather than being added to the list

[REQUIRED] Steps to reproduce

curl ‘http://localhost:9000/.settings/functionTriggers.json?ns=test-project’ -X PUT -H ‘authorization: Bearer owner’ --data-binary ‘[{“name”:“projects/test-project/locations/_/functions/NewPost”,“path”:“/posts/{ownerId}/{postId}”,“event”:“providers/google.firebase.database/eventTypes/ref.create”,“topic”:“projects/test-project/topics/NewPost”}]’ --compressed {“status”:“ok”}

curl ‘http://localhost:9000/.settings/functionTriggers.json?ns=test-project’ -H ‘authorization: Bearer owner’ --compressed [{“name”:“projects/test-project/locations/_/functions/NewPost”,“path”:“/posts/{ownerId}/{postId}”,“event”:“providers/google.firebase.database/eventTypes/ref.create”,“topic”:“projects/test-project/topics/NewPost”}]

curl ‘http://localhost:9000/.settings/functionTriggers.json?ns=test-project’ -X PUT -H ‘authorization: Bearer owner’ --data-binary ‘[{“name”:“projects/test-project/locations/_/functions/UpdatePost”,“path”:“/posts/{ownerId}/{postId}”,“event”:“providers/google.firebase.database/eventTypes/ref.update”,“topic”:“projects/test-project/topics/UpdatePost”}]’ --compressed {“status”:“ok”}

curl ‘http://localhost:9000/.settings/functionTriggers.json?ns=test-project’ -H ‘authorization: Bearer owner’ --compressed [{“name”:“projects/test-project/locations/_/functions/UpdatePost”,“path”:“/posts/{ownerId}/{postId}”,“event”:“providers/google.firebase.database/eventTypes/ref.update”,“topic”:“projects/test-project/topics/UpdatePost”}]

[REQUIRED] Expected behavior

Both of the database triggers would be added and listed in the database emulator

[REQUIRED] Actual behavior

Each call is overriding the previous call

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
samtsterncommented, Jul 18, 2019

@IanWyszynski is going to try and add an “upsert” operation.

1reaction
gpfunkcommented, Jul 18, 2019

Thought that may be the case, thanks for the quick feedback!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Realtime Database triggers | Cloud Functions for Firebase
Functions let you handle Realtime Database events at two levels of specificity; you can listen for specifically for only creation, update, or deletion...
Read more >
How to make the Firebase functions emulator trigger based on ...
In my project, I am using both Functions and Realtime Database, so I run the command firebase emulators:start and it starts up both...
Read more >
Firebase Realtime Database Triggers | Cloud Functions ...
Cloud Functions lets you run database operations with full administrative privileges, and ensures that each change to the database is processed individually.
Read more >
Realtime Database triggers (pt. 1) with Cloud Functions for ...
Cloud Functions allows you to write code that responds to changes in your Realtime Database. Doug explains how these triggers work on the ......
Read more >
Realtime Database triggers (pt. 3) with Cloud Functions for ...
Welcome back to our mini series on writing Realtime Database triggers with Cloud Functions for Firebase. In this episode @CodingDoug shows ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found