Skip to content

Error in firebase_functions/private/util.py processing event time attribute #136

Closed

Description

@ekalosak

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).

Activity

  1. ekalosak commented on Sep 16, 2023

    @ekalosak
    ContributorAuthor

    It's worth noting that downgrading firebase-tools from the latest v12.5.4 to the previous v12.5.3 fixes the issue.

    tl;dr fix this bug by running: npm install -g firebase-tools@12.5.3

    Firebase staff - please consider adding an integration test that covers @firestore_fn-triggered functions to the firebase-tools CI.

  2. mitch-36 commented on Sep 24, 2023

    @mitch-36

    Thanks for sharing.
    npm install -g firebase-tools@12.5.3
    Fixed the issue for me too.

  3. joaqo commented on Sep 25, 2023

    @joaqo

    I have the same issue, but running npm install -g firebase-tools@12.5.3 didn't fix it for me.

    I followed the official tutorial to the letter and encountered this issue, so it seems to be quite a big oversight from the firebase team.

    EDIT: I had installed firebase tools from the bash script, had to uninstall it, install this specific npm version, and the issue is now fixed. Official tutorial is still broken though.

  4. brianellin commented on Sep 29, 2023

    @brianellin

    Same issue for me using the latest firebase.tools. Using 12.5.3 via npm for now until the issue is resolved.

    Also, I'd recommend some better docs on "installing" a specific version binary from the firebase.tools website.

  5. exaby73 commented on Oct 9, 2023

    @exaby73
    Contributor

    Snce this issue has been fixed, I'll close this issue. Please comment if you disagree with my decision

  6. jackall3n commented on Oct 10, 2023

    @jackall3n

    Snce this issue has been fixed, I'll close this issue. Please comment if you disagree with my decision

    This is still an issue in the latest version, this issue shouldn't be closed.

  7. joaqo commented on Oct 10, 2023

    @joaqo

    Yeah, this is the 2nd recent issue @exaby73 has closed that hasn't actually been fixed.

  8. exaby73 commented on Oct 11, 2023

    @exaby73
    Contributor

    @jackall3n @joaqo Sorry about this. I realise that the workaround was downgrading the firebase_tools version. Correct me if I am wrong. I'll reopen this issue and investigate further

  9. antopolskiy commented on Oct 12, 2023

    @antopolskiy

    +1 this issue still happens and if not for this thread it would have been very difficult for me to resolve. I spent ~1 hour fruitlessly playing around with versions of various components before finding this. npm install -g firebase-tools@12.5.3 works.

  10. zsais commented on Oct 18, 2023

    @zsais

    +1 this issue still exists

  11. exaby73 commented on Oct 19, 2023

    @exaby73
    Contributor

    @zsais @joaqo Could you check this issue against the main branch by change the dependency in your requirements.txt?

    Change firebase_functions=<version> to git+https://github.com/firebase/firebase-functions-python.git@main#egg=firebase-functions

  12. exaby73 commented on Jan 15, 2024

    @exaby73
    Contributor

    Could you please check with the latest version 0.2.0 and confirm if this issue is fixed on your side? There was a PR that was merged but not released earlier which may have fixed this issue

  13. antopolskiy commented on Feb 22, 2024

    @antopolskiy

    I just tried it with firebase-tools v13.3.0 and it still fails.

  14. exaby73 commented on Mar 8, 2024

    @exaby73
    Contributor

    Hey @antopolskiy if you can still reproduce it, could you provide me with your stack trace?

  15. moved this from Needs Acknowledgment to backlog in [Cloud] Extensions + Functionson Jun 5, 2025
  16. CorieW commented on Jun 25, 2025

    @CorieW
    Member

    Hi @ekalosak.

    Thanks for reporting this issue. I've managed to reproduce (MRE) it using the following versions:

    • firebase_functions: v0.1.1
    • firebase-tools: v12.5.4 (and all later versions)
    • firebase-admin: v6.2.0

    To fix this issue, you can either:

    • Update from firebase_functions v0.1.1 to v0.1.2.
    • Update to the latest version of firebase_functions (v0.4.3).

    Since there are good solutions to this issue, I'm going to close this issue here. However, if you have any further comments or problems with the solutions, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions