firebase-functions-python
firebase-functions-python copied to clipboard
Error in firebase_functions/private/util.py processing event time attribute
After updating firebase-tools, using the functions emulator, any time an @firestore_fn
-decorated function is executed, I get this error:
...
> File "/.../venv/lib/python3.11/site-packages/firebase_functions/firestore_fn.py", line 115, in _firestore_endpoint_handler
> is_nanoseconds = _util.is_precision_timestamp(time)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/.../venv/lib/python3.11/site-packages/firebase_functions/private/util.py", line 333, in is_precision_timestamp
> _, s_fraction = time.split(".")
> ^^^^^^^^^^^^^
> ValueError: not enough values to unpack (expected 2, got 1)
The relevant code includes this block from firebase_fn.py and this block from private/util.py.
After upgrading to the latest firebase tools npm install -g firebase-tools
to v12.5.4
, the CloudEvent event's time attribute has this iso format: 2023-09-16T13:32:06Z
extracted by adding a print() call to the firebase_functions' site-package source.
So, that unprotected time.split('.')
call isn't accounting for the ostensible change to the time attribute's format.
I'm using Python 3.11.4 on macOS 12.6 with firebase-functions v0.1.1 (latest).