Hello! 👋
There is a bug in the logic to generate the "after" state of a (realtime) database change. The bug appears to be in the below lines of code, only a shallow copy/merge is performed but a deep one is needed.
|
# Merge delta into data to generate an 'after' view of the data. |
|
if isinstance(before, dict) and isinstance(after, dict): |
|
after = _util.prune_nones({**before, **after}) |
As an example of a failure case, I had just changed allocation/change from F to G in the following:

However I have a listener setup on the root object of the screenshot and the event.data object that is generated by that change was:
Change(
before={'allocation': {'change': 'F', 'role': 'admin', 'third': 3}, 'details': <redacted>},
after={'allocation': {'change': 'G'}, 'details': <redacted>})
It should be:
Change(
before={'allocation': {'change': 'F', 'role': 'admin', 'third': 3}, 'details': <redacted>},
after={'allocation': {'change': 'G', 'role': 'admin', 'third': 3}, 'details': <redacted>})
Let me know if you need any more info.
Thanks!
Hello! 👋
There is a bug in the logic to generate the "after" state of a (realtime) database change. The bug appears to be in the below lines of code, only a shallow copy/merge is performed but a deep one is needed.
firebase-functions-python/src/firebase_functions/db_fn.py
Lines 92 to 94 in 14676e5
As an example of a failure case, I had just changed

allocation/changefromFtoGin the following:However I have a listener setup on the root object of the screenshot and the
event.dataobject that is generated by that change was:It should be:
Let me know if you need any more info.
Thanks!