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
Functions emulator only maintaining last realtime database trigger #1523
Comments
@gpfunk thanks for reporting this! I will investigate this now and see if I can reproduce. |
Confirmed this is a bug, now to find where it lives. |
god speed :) |
Ok this is one of those "working as intended but still a bug" things. Basically the What we really need is an "upsert" operation implemented in the RTDB emulator that we can call using a trigger name as a unique ID. This is what Firestore has. We'll talk about it today and hopefully get a solution. |
Thought that may be the case, thanks for the quick feedback! |
@IanWyszynski is going to try and add an "upsert" operation. |
[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
The text was updated successfully, but these errors were encountered: