TypeError json.encoder in default instead of real error, using sentry-sdk python
See original GitHub issueEnvironment
SaaS (https://sentry.io/)
Version
No response
Steps to Reproduce
- have an URL triggering an error that contains special chars, for example an “!”
- in sentry, I’ll get a strange
TypeError json.encoder in default
- with an epic long stacktrace, that goes through all my django middlewares and more
- using gunicorn. not sure if on my side something is configured wrong? as far as I can see, I use a very basic default configuration
python sentry-sdk: 1.4.2
sentry_sdk.init(
dsn=SENTRY_DSN,
release=VERSION,
integrations=[DjangoIntegration()],
)
Expected Result
Report AttributeError 'NoneType' object has no attribute 'url_name'
as is the orginal error in this case.
Actual Result
TypeError json.encoder in default
the (probably) payload, that is wanted to be json serialized:
{
environment: 'production',
public_key: 'blbalbalbablaFOOOOO,
release: b'0.0.1-178-g889a3c7',
trace_id: 'the-trace-id',
transaction: '/medien/Pressedossier_PENG!_PALAST.pdf'
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
TypeError json.encoder in default instead of real error ... - GitHub
have an URL triggering an error that contains special chars, for example an "!" in sentry, I'll get a strange TypeError json.encoder in...
Read more >Custom JSON Encoder raises "Object not JSON serializable ...
I am trying to create a custom JSON Encoder for one of my classes. I have created a simplified version to try the...
Read more >Issue 24313: json fails to serialise numpy.int64 - Python tracker
I use json 2.0.9 and numpy 1.9.2 with both versions of Python. ... 174 175 def encode(self, o): TypeError: 1 is not JSON...
Read more >1657425 - sentry errors while running `mach python-test`
I ran mach python-test python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py from my objdir, and got output that looked like:
Read more >Logging - Sentry Documentation
event_level (default ERROR ): The Sentry Python SDK will report log records with a level higher than or equal to event_level as events....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@benzkji, I had the same issue, with this same apparent cause. Your
release
argument toinit()
is of typebytes
. You should adddecode()
after it to convert it to a string. That resolved the issue for me. Though it is interesting that this only happened as of v1.4.0a link like this: https://sentry.io/organizations/bnzk/issues/2681863712/?project=5803770&query=is%3Aunresolved