Code Monkey home page Code Monkey logo

Comments (5)

Balazs23 avatar Balazs23 commented on August 24, 2024

Same issue for me, just I started with the sample

i  functions: Beginning execution of "europe-west1-onfirestoredocumentwritten"
>  [2023-05-24 14:06:55,688] ERROR in app: Exception on /functions/projects/ [POST]
>  Traceback (most recent call last):
>    File "/workspaces/firebase-sample/functions/venv/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
>      response = self.full_dispatch_request()
>                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>    File "/workspaces/firebase-sample/functions/venv/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
>      rv = self.handle_user_exception(e)
>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>    File "/workspaces/firebase-sample/functions/venv/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
>      rv = self.dispatch_request()
>           ^^^^^^^^^^^^^^^^^^^^^^^
>    File "/workspaces/firebase-sample/functions/venv/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
>      return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
>             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>    File "/workspaces/firebase-sample/functions/venv/lib/python3.11/site-packages/functions_framework/__init__.py", line 174, in view_func
>      function(event)
>    File "/workspaces/firebase-sample/functions/venv/lib/python3.11/site-packages/firebase_functions/firestore_fn.py", line 208, in on_document_written_wrapped
>      return _firestore_endpoint_handler(
>             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>    File "/workspaces/firebase-sample/functions/venv/lib/python3.11/site-packages/firebase_functions/firestore_fn.py", line 114, in _firestore_endpoint_handler
>      event_time = _dt.datetime.strptime(
>                   ^^^^^^^^^^^^^^^^^^^^^^
>    File "/usr/local/lib/python3.11/_strptime.py", line 568, in _strptime_datetime
>      tt, fraction, gmtoff_fraction = _strptime(data_string, format)
>                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>    File "/usr/local/lib/python3.11/_strptime.py", line 349, in _strptime
>      raise ValueError("time data %r does not match format %r" %
>  ValueError: time data '2023-05-24T14:06:54.424379216Z' does not match format '%Y-%m-%dT%H:%M:%S.%f%z'
i  functions: Finished "europe-west1-onfirestoredocumentwritten" in 21.14ms

versions:
firebase-functions: 59d68cf
firebase cli version: 12.2.0
firebase emulator version: v1.17.4

I did a short research and the class implements the generic CloudEvent. Current version from the spec is v1.0.2 says the Timestamp format is RFC 3339 - it should match with %Y-%m-%dT%H:%M:%S.%f%z. Maybe the issue is with the emulator because 2023-05-24T14:06:54.424379216Z fractional seconds component 424379216 exceeds the six-digit limit specified by the RFC.

from firebase-functions-python.

kozzza avatar kozzza commented on August 24, 2024

Is there a workaround for this right now? I can't run test my firestore cloud functions at all without running into this error.

from firebase-functions-python.

arturoszulc avatar arturoszulc commented on August 24, 2024

Same problem here. Yesterday it worked, when I deployed my python function for the first time on functions emulator. After that I keep getting this error.

from firebase-functions-python.

kylemilden avatar kylemilden commented on August 24, 2024

We are having the same issue in a live environment when the milliseconds happen to be 0. It looks like on line 65 of cloudevents.http.event.py it is trying to add the time attribute to the event using isoformat which is dropping off the milliseconds. Then in firebase_functions.pubsub_fn.py on line 108 it is trying to parse that time assuming that there are milliseconds and it is throwing the same error everyone else is seeing.

File "/layers/google.python.pip/pip/lib/python3.11/site-packages/functions_framework/__init__.py", line 174, in view_func
function(event)
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/firebase_functions/pubsub_fn.py", line 184, in on_message_published_wrapped
return _message_handler(func, raw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/firebase_functions/pubsub_fn.py", line 108, in _message_handler
time = _dt.datetime.strptime(
^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.runtime/python/lib/python3.11/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.runtime/python/lib/python3.11/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '2023-06-13T15:17:49Z' does not match format '%Y-%m-%dT%H:%M:%S.%f%z'

from firebase-functions-python.

xSavian avatar xSavian commented on August 24, 2024

Release exist with this fix? I'm still have this issue sometimes

from firebase-functions-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.