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:
- Created 4 years ago
- Comments:6 (4 by maintainers)
@IanWyszynski is going to try and add an “upsert” operation.
Thought that may be the case, thanks for the quick feedback!