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

EncodeError: Object of type LimitContext is not JSON serializable #19100

Closed
sentry-io bot opened this issue Dec 5, 2023 · 4 comments · Fixed by #19102
Closed

EncodeError: Object of type LimitContext is not JSON serializable #19100

sentry-io bot opened this issue Dec 5, 2023 · 4 comments · Fixed by #19102
Labels
bug Something isn't working right

Comments

@sentry-io
Copy link

sentry-io bot commented Dec 5, 2023

Sentry Issue: POSTHOG-N81

TypeError: Object of type LimitContext is not JSON serializable
(3 additional frame(s) were not displayed)
...
  File "__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "kombu/utils/json.py", line 45, in default
    return super().default(o)
  File "json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '

EncodeError: Object of type LimitContext is not JSON serializable
(16 additional frame(s) were not displayed)
...
  File "__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "kombu/utils/json.py", line 45, in default
    return super().default(o)
  File "json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
@webjunkie
Copy link
Contributor

@mariusandra this for me breaks async queries. I can take a look later.

@webjunkie webjunkie added the bug Something isn't working right label Dec 5, 2023
@mariusandra
Copy link
Collaborator

Oh, this is indeed something I recently added. Tests passed, so didn't expect anything to break. Probably some case to add?

This should fix it according to the internet, but I didn't test it yet: #19102

@webjunkie webjunkie linked a pull request Dec 5, 2023 that will close this issue
@webjunkie
Copy link
Contributor

Probably some case to add?

This is in the call to Celery's delay, where Celery puts the arguments into the queue, so hence we bypass it in tests. Would be more on the integration test side of things. I looked it up and not sure how to test, other than manually serializing specifically for this call and checking that it works. But it's not 1:1 what happens inside Celery.

@mariusandra
Copy link
Collaborator

Hmm... that does sound involved, and probably better to skip. Thanks for investigating!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants