Firebase-tools: 最後のリアルタイム データベース トリガーのみを維持する関数エミュレーター

作成日 2019年07月18日  ·  6コメント  ·  ソース: firebase/firebase-tools

【必須】環境情報


firebase-tools:
ファイアベース: 7.1.1
ノード: v10.16.0
Java: 11.0.2


プラットホーム:
マックOS

【必須】テストケース

これは、 dad143c42445056014f6f48cc9dfa13156e3c186 の firebase-tools/functionsEmulator.ts の行に表示され
、新しいトリガーを追加するリクエストは、リストに追加されるのではなく、追加された以前のトリガーを上書きします

【必須】再現手順

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"}]' -- 圧縮
{"ステータス":"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"}]' -- 圧縮
{"ステータス":"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"}]

[必須] 期待される動作

両方のデータベース トリガーが追加され、データベース エミュレーターに一覧表示されます。

【必須】実際の挙動

各呼び出しは前の呼び出しを上書きします

emulator-suite database functions bug

全てのコメント6件

@gpfunk報告してくれてありがとう! 今すぐ調査して、再現できるか確認します。

これがバグであることを確認しました。次に、それがどこにあるのかを調べます。

神速:)

これは、「意図したとおりに機能しているが、まだバグ」の 1 つです。 基本的に、 firebase-toolsコード (お気づきのとおり) は、各関数のfunctionTriggersリソース全体にPUTを送信し、それを置き換えます。

本当に必要なのは、トリガー名を一意の ID として使用して呼び出すことができる RTDB エミュレーターに実装された「アップサート」操作です。 これが Firestore の特徴です。 今日はそれについて話し、うまくいけば解決策が得られると思います。

そうかもしれないと思いました、迅速なフィードバックに感謝します!

@IanWyszynskiは、「upsert」操作を試して追加しようとしています。

このページは役に立ちましたか?
0 / 5 - 0 評価