You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a particular spot in my code that is confusing pyrollbar. Stack trace below. The error I'm seeing from pyrollbar is:
ERROR:rollbar:Exception while reporting exc_info to Rollbar. TypeError("<SimpleLazyObject: u'*****'> is not JSON serializable",)
Traceback (most recent call last):
File "/home/mgalgs/sites/str-prod/env/lib/python2.7/site-packages/rollbar/__init__.py", line 412, in report_exc_info
return _report_exc_info(exc_info, request, extra_data, payload_data, level=level)
File "/home/mgalgs/sites/str-prod/env/lib/python2.7/site-packages/rollbar/__init__.py", line 688, in _report_exc_info
send_payload(payload, data.get('access_token'))
File "/home/mgalgs/sites/str-prod/env/lib/python2.7/site-packages/rollbar/__init__.py", line 450, in send_payload
payload_str = _serialize_payload(payload)
File "/home/mgalgs/sites/str-prod/env/lib/python2.7/site-packages/rollbar/__init__.py", line 1331, in _serialize_payload
return json.dumps(payload)
File "/usr/lib64/python2.7/json/__init__.py", line 244, in dumps
return _default_encoder.encode(obj)
File "/usr/lib64/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib64/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "/usr/lib64/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <SimpleLazyObject: u'kC5HxodgKpBDAip5mBSJDaxHrnT7vrTHAI2t1Ffq8NxRfr4XqOn5BMNTon5C4NcG'> is not JSON serializable
I redacted the SimpleLazyObject string represenation with ***** just in case that contains any sensitive information like my API key, not sure what it is. Kind of seems like a base64 string of some sort, but base-64 decoded it just looks like gibberish.
pyrollbar has been working fine elsewhere in my project for years, I just noticed this issue this morning. I upgraded to the latest version of pyrollbar (0.14.5) and am still seeing this issue.
In case it's helpful, the stack trace generating this exception is:
Internal Server Error: /shops/nuther-shoppie/
Traceback (most recent call last):
File "/home/mgalgs/sites/str-prod/env/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/mgalgs/sites/str-prod/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
response = self._get_response(request)
File "/home/mgalgs/sites/str-prod/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/mgalgs/sites/str-prod/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/mgalgs/sites/str-prod/env/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/home/mgalgs/sites/str-prod/shop/views.py", line 32, in sonlet_shops_view
return render(request, "shop/sonlet_shops.html")
File "/home/mgalgs/sites/str-prod/env/lib/python2.7/site-packages/django/shortcuts.py", line 30, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "/home/mgalgs/sites/str-prod/env/lib/python2.7/site-packages/django/template/loader.py", line 68, in render_to_string
return template.render(context, request)
File "/home/mgalgs/sites/str-prod/env/lib/python2.7/site-packages/django/template/backends/django.py", line 66, in render
return self.template.render(context)
File "/home/mgalgs/sites/str-prod/env/lib/python2.7/site-packages/django/template/base.py", line 205, in render
with context.bind_template(self):
File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/home/mgalgs/sites/str-prod/env/lib/python2.7/site-packages/django/template/context.py", line 263, in bind_template
updates.update(processor(self.request))
File "/home/mgalgs/sites/str-prod/unicorn/context_processors.py", line 76, in customer_data
1/0
ZeroDivisionError: integer division or modulo by zero
(I'm intentionally raising an exception / trying to destroy the universe with that 1/0)
I'm still seeing errors reported from elsewhere in my app, it's just this one particular stack trace the pyrollbar is choking on...
The text was updated successfully, but these errors were encountered:
SimpleLazyObject comes from Django, so somewhere an object of that type is getting mixed into the payload and then is choking on serializing it. My cursory searching seems to imply that the Django uses this class for request.user which we probably get access to from the request via our middleware. I'm not sure why this would have happened all of a sudden for you unless you upgraded Django versions or changed how a user is being stored or something.
I don't really like the idea of special casing a particular class, but I can't quite see how else to resolve this at the moment. I'm going to try to do it in the least gross way.
I have a particular spot in my code that is confusing pyrollbar. Stack trace below. The error I'm seeing from pyrollbar is:
I redacted the
SimpleLazyObject
string represenation with*****
just in case that contains any sensitive information like my API key, not sure what it is. Kind of seems like a base64 string of some sort, but base-64 decoded it just looks like gibberish.pyrollbar has been working fine elsewhere in my project for years, I just noticed this issue this morning. I upgraded to the latest version of pyrollbar (0.14.5) and am still seeing this issue.
In case it's helpful, the stack trace generating this exception is:
(I'm intentionally raising an exception / trying to destroy the universe with that
1/0
)I'm still seeing errors reported from elsewhere in my app, it's just this one particular stack trace the pyrollbar is choking on...
The text was updated successfully, but these errors were encountered: