Skip to content

Mimic behavior from Node.js on KeyError #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Zaffer opened this issue Apr 20, 2025 · 2 comments
Open

Mimic behavior from Node.js on KeyError #233

Zaffer opened this issue Apr 20, 2025 · 2 comments
Labels
triaged Triaged waiting for customer response Issue is on hold awaiting more information from OP

Comments

@Zaffer
Copy link

Zaffer commented Apr 20, 2025

When a field does not exist on a document, the Python Cloud Function throws an error KeyError, but for the Node.js implementation it simply returns undefined (preferred).
This is especially important for the on_document_written function, which might trigger for updates that need to be monitored, but if the document is created for the first time without fields yet, then this should not throw an error ideally.

@CorieW
Copy link
Contributor

CorieW commented Apr 28, 2025

Hi @Zaffer,

Thanks for reporting this issue! We’ve received it and are reviewing it. We’ll provide updates as soon as possible.

@CorieW
Copy link
Contributor

CorieW commented Apr 28, 2025

This could be due to the differences between these languages.

For example, in Python some_dict['invalid_property'] throws KeyError, when in Node some_dict['invalid_property'] returns undefined. Instead, you can probably use some_dict.get('invalid_property') (in Python) to get None returned.

Could you perhaps send over a code snippet that produces this issue, just to be certain?

@CorieW CorieW added waiting for customer response Issue is on hold awaiting more information from OP triaged Triaged labels Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Triaged waiting for customer response Issue is on hold awaiting more information from OP
Projects
None yet
Development

No branches or pull requests

2 participants