#218 — Widget nightly updated: TypeError: Object of type datetime is not JSON serializable

Repo: Twill-AI/facade State: closed | Status: done Assignee: Unassigned

Created: 2024-11-28 · Updated: 2025-03-24

Description

https://twill-network.slack.com/archives/C078KS0R05B/p1732811949234669?thread_ts=1732792107.663669&cid=C078KS0R05B

Error log:

2024-11-28 04:00:17.110|ERROR|-no-tenant|jobs:128|Error updating widget for tenant MchlWrghtt: Object of type datetime is not JSON serializable
Traceback (most recent call last):
  File ""/app/app/jobs/jobs.py"", line 117, in run_nightly_updates
    Widget.values_rows: json.dumps(
                        ^^^^^^^^^^^
  File ""/usr/local/lib/python3.12/json/__init__.py"", line 238, in dumps
    **kw).encode(obj)
          ^^^^^^^^^^^
  File ""/usr/local/lib/python3.12/json/encoder.py"", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ""/usr/local/lib/python3.12/json/encoder.py"", line 258, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
  File ""/app/app/jobs/jobs.py"", line 18, in default
    return super(DecimalEncoder, self).default(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ""/usr/local/lib/python3.12/json/encoder.py"", line 180, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type datetime is not JSON serializable

Now that we are passing created_at and updated_at values from widgets, they may end up getting serialized.

STR:

  • Wait for widget nightly updat

Notes

Add implementation notes, blockers, and context here

Add wikilinks to related people, meetings, or other tickets