Skip to content

TypeError: Object of type Hashid is not JSON serializable #33

Description

@icemac

I saw the following error:

Exception in thread kolo-save_request_in_db:
Traceback (most recent call last):
  File ".../lib/python3.9/threading.py", line 980, in _bootstrap_inner
[23/Sep/2022 15:45:28] "POST /api/v1/treatment_request/ HTTP/1.0" 201 116
    self.run()
  File ".../lib/python3.9/threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File ".../kolo-2.0.3-py3.9.egg/kolo/profiler.py", line 233, in save_request_in_db
    self.db_path, self.trace_id, json.dumps(json_data), wal_mode
  File ".../lib/python3.9/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File ".../lib/python3.9/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File ".../lib/python3.9/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File ".../lib/python3.9/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Hashid is not JSON serializable

I believe the Hashid comes from django-hashid-field.

Python: 3.9
Django: 4.0.7
kolo: 2.0.3
django-hashid-field: 3.3.5

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions