Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with TypeError: Object of type bytes is not JSON serializable #3488

Open
leplatrem opened this issue Feb 4, 2025 · 0 comments · May be fixed by #3489
Open

Crash with TypeError: Object of type bytes is not JSON serializable #3488

leplatrem opened this issue Feb 4, 2025 · 0 comments · May be fixed by #3489
Labels

Comments

@leplatrem
Copy link
Contributor

 http :8888/v1/buckets "Accept:text/html,text/plain;q=0.9"
"GET   /v1/buckets?" ? (? ms) Object of type bytes is not JSON serializable errno=999
Traceback (most recent call last):
  File "/path/to/.venv/lib/python3.13/site-packages/pyramid/tweens.py", line 41, in excview_tween
    response = handler(request)
  File "/path/to/.venv/lib/python3.13/site-packages/kinto/core/events.py", line 166, in tween
    response = handler(request)
  File "/path/to/.venv/lib/python3.13/site-packages/pyramid/router.py", line 143, in handle_request
    response = _call_view(
        registry, request, context, context_iface, view_name
    )
  File "/path/to/.venv/lib/python3.13/site-packages/pyramid/view.py", line 674, in _call_view
    response = view_callable(context, request)
  File "/path/to/.venv/lib/python3.13/site-packages/pyramid/config/views.py", line 151, in __call__
    return view(context, request)
  File "/path/to/.venv/lib/python3.13/site-packages/pyramid/viewderivers.py", line 392, in viewresult_to_response
    result = view(context, request)
  File "/path/to/.venv/lib/python3.13/site-packages/pyramid/viewderivers.py", line 141, in _requestonly_view
    response = view(request)
  File "/path/to/.venv/lib/python3.13/site-packages/cornice/pyramidhook.py", line 72, in _fallback_view
    error = service.error_handler(request)
  File "/path/to/.venv/lib/python3.13/site-packages/kinto/core/__init__.py", line 128, in error_handler
    return errors.json_error_handler(request)
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/path/to/.venv/lib/python3.13/site-packages/kinto/core/errors.py", line 159, in json_error_handler
    response = http_error(
        httpexceptions.HTTPBadRequest(),
    ...<4 lines>...
        details=errors,
    )
  File "/path/to/.venv/lib/python3.13/site-packages/kinto/core/errors.py", line 120, in http_error
    response.json = ErrorSchema().deserialize(body)
    ^^^^^^^^^^^^^
  File "/path/to/.venv/lib/python3.13/site-packages/webob/response.py", line 577, in _json_body__set
    self.body = json.dumps(value, separators=(',', ':')).encode('UTF-8')
                ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
          ~~~~~~^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/json/encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/opt/homebrew/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/json/encoder.py", line 261, in iterencode
    return _iterencode(o, 0)
  File "/opt/homebrew/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/json/encoder.py", line 180, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
                    f'is not JSON serializable')
TypeError: Object of type bytes is not JSON serializable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant