FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Realtime Database After Event Missing values · Issue #122 · firebase/firebase-functions-python · GitHub

Realtime Database After Event Missing values  #122

Description

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!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


Back | FazBrowse Home | New Git URL