firebase-functions-python icon indicating copy to clipboard operation
firebase-functions-python copied to clipboard

scheduler has date format error when deployed to cloud run functions v2

Open escottgoodwin opened this issue 2 months ago • 3 comments

using decorator

@scheduler_fn.on_schedule(schedule="0 * * * *", timezone="America/Los_Angeles", memory=options.MemoryOption.GB_1, timeout_sec=540)

gives ths error with firebase-functions==0.4.2

"Exception on / [POST] Traceback (most recent call last): File "/layers/google.python.pip/pip/lib/python3.13/site-packages/flask/app.py", line 1511, in wsgi_app response = self.full_dispatch_request() File "/layers/google.python.pip/pip/lib/python3.13/site-packages/flask/app.py", line 919, in full_dispatch_request rv = self.handle_user_exception(e) File "/layers/google.python.pip/pip/lib/python3.13/site-packages/flask/app.py", line 917, in full_dispatch_request rv = self.dispatch_request() File "/layers/google.python.pip/pip/lib/python3.13/site-packages/flask/app.py", line 902, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^ File "/layers/google.python.pip/pip/lib/python3.13/site-packages/functions_framework/execution_id.py", line 106, in wrapper return view_function(*args, **kwargs) File "/layers/google.python.pip/pip/lib/python3.13/site-packages/functions_framework/init.py", line 142, in view_func return function(request._get_current_object()) File "/layers/google.python.pip/pip/lib/python3.13/site-packages/firebase_functions/scheduler_fn.py", line 103, in on_schedule_wrapped schedule_time = _dt.datetime.strptime( schedule_time_str, "%Y-%m-%dT%H:%M:%S%z", ) File "/layers/google.python.runtime/python/lib/python3.13/_strptime.py", line 789, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^ File "/layers/google.python.runtime/python/lib/python3.13/_strptime.py", line 555, in _strptime raise ValueError("time data %r does not match format %r" % (data_string, format)) ValueError: time data '2025-11-08T20:00:01.670593-08:00' does not match format '%Y-%m-%dT%H:%M:%S%z'"

escottgoodwin avatar Nov 09 '25 03:11 escottgoodwin

Hi @escottgoodwin , thank you for reporting this issue. We'll investigate and keep you posted. Thanks!

HassanBahati avatar Nov 10 '25 12:11 HassanBahati

Hi @escottgoodwin.

There was recently a release that improved date parsing in the scheduler. Could you update to the latest version and see if that fixes your problem?

CorieW avatar Nov 11 '25 13:11 CorieW

For what it's worth I am not OP and probably don't have exact same dev environment as them, but...

I had the exact same issue: Using scheduled funtiosn on a regular schedule such as "every 10 minutes" or "*/10 * * ..." resulted in the same logs as OP. Functions that were scheduled at specific times were not affected. Functions would run fine if using force run in cloud scheduler (but this is proobably because decorator is bypassed?). Also, interestingly, the functions would always run correctly on their first scheduled run, but never after that.

Anyways, using the advice here and upgrading firebase-tools to 0.5.0 and setting "firebase-functions==0.5.0" in reqirements.txt (it was firebase_functions~=0.1.0 before) fixed the issue! This was a head scratcher.

flizmflop avatar Nov 21 '25 06:11 flizmflop