question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for Sanic v21.12.0

See original GitHub issue

Raising custom exceptions in Sanic’s latest version (which shouldn’t be logged to Sentry), getting IndexError: pop from empty list

File "/app/.heroku/python/lib/python3.9/site-packages/sentry_sdk/integrations/sanic.py", line 184, in _hub_exit
     request.ctx._sentry_hub.__exit__(None, None, None)
File "/app/.heroku/python/lib/python3.9/site-packages/sentry_sdk/hub.py", line 247, in __exit__
     old = self._old_hubs.pop()
IndexError: pop from empty list

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
ahopkinscommented, Jan 3, 2022

In the meantime, if someone wants to get this working with Sanic v21.12 you can monkeypatch it like this:

from contextlib import suppress
import sentry_sdk

async def _hub_exit_modified(request, **_):
    with suppress(IndexError):
        request.ctx._sentry_hub.__exit__(None, None, None)


sentry_sdk.integrations.sanic._hub_exit = _hub_exit_modified
1reaction
ahopkinscommented, Apr 19, 2022

Thanks for the reminder. I’ll take a look at it this week and add a patch (unless someone else does first).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Version 21.12 (LTS) - Sanic Framework
This is the final release of the version 21 release cycle. Version 21 will now enter long-term support and will be supported for...
Read more >
Sanic | Build fast. Run fast. — Sanic 22.9.1 documentation
Sanic is a Python 3.7+ web server and web framework that's written to go fast. It allows the usage of the async/await syntax...
Read more >
Sanic v21.12 LTS Released : r/Python - Reddit
First class integration support for Sanic Extensions. Contextual exceptions for easier and more consistent error handling. Upgraded background ...
Read more >
sanic-plugin-toolkit - PyPI
Notice: Please update to SPTK v0.90.1 if you need compatibility with Sanic v21.03+. The Enhanced Middleware System. The Middleware system in the Sanic...
Read more >
sanic | Read the Docs
latest · stable · v22.9.1 · v22.9.0 · v22.6.2 · v22.6.1 · v22.6.0 · v22.3.2 · v22.3.1 · v22.3.0 · v21.12.1 · v21.12.0...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found