long2ice / meilisync

Realtime sync data from MySQL/PostgreSQL/MongoDB to Meilisearch
https://github.com/long2ice/meilisync
Apache License 2.0
285 stars 43 forks source link

TypeError: Object of type Decimal is not JSON serializable #97

Open devcxl opened 7 months ago

devcxl commented 7 months ago

2024-04-23T11:14:05.440428411Z │ │           o = [                                                          │ │
2024-04-23T11:14:05.440433580Z │ │               │   {                                                      │ │
2024-04-23T11:14:05.440438329Z │ │               │   │   'filename':                                        │ │
2024-04-23T11:14:05.440444615Z │ │               'ca57298e615ab2d4875db18590befaad.png',                    │ │
2024-04-23T11:14:05.440498394Z │ │               │   │   'data':                                           │ │
2024-04-23T11:14:05.440505169Z │ │               Decimal('1056218744737726101909875705338'),                │ │
2024-04-23T11:14:05.440536668Z │ │               │   }                                                      │ │
2024-04-23T11:14:05.440542954Z │ │               ]                                                          │ │
2024-04-23T11:14:05.440548541Z │ │        self = <json.encoder.JSONEncoder object at 0x7fc5aebe2690>        │ │
2024-04-23T11:14:05.440553779Z │ ╰──────────────────────────────────────────────────────────────────────────╯ │
2024-04-23T11:14:05.440559017Z │                                                                              │
2024-04-23T11:14:05.440562789Z │ /usr/local/lib/python3.12/json/encoder.py:180 in default                     │
2024-04-23T11:14:05.440568097Z │                                                                              │
2024-04-23T11:14:05.440572497Z │   177 │   │   │   │   return JSONEncoder.default(self, o)                    │
2024-04-23T11:14:05.440581926Z │   178 │   │                                                                  │
2024-04-23T11:14:05.440587094Z │   179 │   │   """                                                            │
2024-04-23T11:14:05.440592402Z │ ❱ 180 │   │   raise TypeError(f'Object of type {o.__class__.__name__} '      │
2024-04-23T11:14:05.440596663Z │   181 │   │   │   │   │   │   f'is not JSON serializable')                   │
2024-04-23T11:14:05.440602530Z │   182 │                                                                      │
2024-04-23T11:14:05.440608257Z │   183 │   def encode(self, o):                                               │
2024-04-23T11:14:05.440612936Z │                                                                              │
2024-04-23T11:14:05.440618104Z │ ╭────────────────────────── locals ──────────────────────────╮               │
2024-04-23T11:14:05.440623413Z │ │    o = Decimal('1056218744737726101909875705338')          │               │
2024-04-23T11:14:05.440628651Z │ │ self = <json.encoder.JSONEncoder object at 0x7fc5aebe2690> │               │
2024-04-23T11:14:05.440633051Z │ ╰────────────────────────────────────────────────────────────╯               │
2024-04-23T11:14:05.440639756Z ╰──────────────────────────────────────────────────────────────────────────────╯
2024-04-23T11:14:05.440644924Z TypeError: Object of type Decimal is not JSON serializable
2024-04-23T11:14:05.499338434Z Exception ignored in: <function StreamWriter.__del__ at 0x7fc5adf66480>
2024-04-23T11:14:05.499379851Z 
long2ice commented 7 months ago

fixed

ilogus commented 6 months ago

Hi @long2ice, do you know how can we got this fix in the docker version, do you recommand us to build our own version with the latest fix ? Thx :)

andrefrcastro commented 1 month ago

We're also getting this error in the docker version

devcxl commented 1 month ago

The long2ice/meilisync:dev image has already fixed this error