rules. debug
debug
デバッグ(
セキュリティ ルール言語を出力する基本的なデバッグ関数
変数、ステートメント結果がそのままの状態に
ルール エンジンによって評価されます。debug
の出力は、次のテーブルに書き込まれます。
firestore-debug.log です。
debug
関数は Rules 内でのみ呼び出す
conditions。
debug
関数ブロックは、セキュリティ ルール エンジンによってのみ実行されます。
Firebase Emulator Suite の一部である Firestore エミュレータを使用できます。デバッグ
本番環境には影響しません。
デバッグ ログファイルのエントリの先頭には、ルールを識別する文字列が付加されます。
ログ出力の言語データ型(例: string_value
、
map_value
)。
debug
の呼び出しはネストできます。
現在、debug
機能はロギングのコンセプトをサポートしていません。
(INFO、WARN、ERROR など)。
// firestore.rules
// Nested debug calls in the following match block....
match /carts/{cartID} {
allow create: if request.auth != null && request.auth.uid == request.resource.data.ownerUID;
allow read, update, delete: if
debug(
debug(request.auth.uid) == debug(resource.data.ownerUID)
);
}
...
// firestore-debug.log
// ...produce logfile output like the following.
string_value: "alice" // for debug(request.auth.uid)
string_value: "alice" // for debug(resource.data.ownerUID)
bool_value: true // for the outermost enclosing debug() call
...