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
'types.SimpleNamespace' object has no attribute '_sentry_hub' #1303
Comments
I cannot recreate this. This seems to work as expected using:
import sentry_sdk
from sentry_sdk.integrations.sanic import SanicIntegration
from sanic import Sanic, text
sentry_sdk.init(
dsn="https://555f76ca77cc40f9ba5dd92c69a2d4a3@o622198.ingest.sentry.io/5909200",
integrations=[SanicIntegration()],
)
app = Sanic(__name__)
@app.exception(ZeroDivisionError)
async def zero(*_):
return text("0")
@app.get("/")
async def handler(request):
1 / 0
app.run(port=9999, debug=True) |
I'm still having this issue while being on sanic==21.12.0 The original issue seems to be from: ./site-packages/sanic/server/protocols/http_protocol.py, line 110:
I suspect that since the issue occurs later in the process, it is executed outside the There also might be an issue with my "connection_task" executed for "http.lifecycle.begin" ? If you need anything else, please ask. |
I'm continuing this issue as I recently pushed an update on my code that triggered two new similar issues at Sentry. Unfortunately, Sentry doesn't provide any more details on the origin of the issue so it's hard for me to understand where the problem originates and to go up the ladder until I identify the problem.
One of my guesses is that I do quite some work once the request is finished (I commit to the database, run some asynchronous tasks (via Celery). I suspect that the exception occurs once the requests have finished, which causes the |
I'm also facing this issue. application is working fine, just test are not running. If i just remove the sentry codes, then test are passed. code to reproduce the error:
# server.py
from sanic import Sanic
from sanic.response import json
import sentry_sdk
from sentry_sdk.integrations.sanic import SanicIntegration
sentry_sdk.init(
dsn="https://d155ac31cc134af588a34fa2b0d870f4@o316508.ingest.sentry.io/6253212",
integrations=[SanicIntegration()]
)
app = Sanic("test")
@app.route('/')
async def test(request):
return json({'message': 'hola'})
if __name__ == "__main__":
app.run(host='0.0.0.0', port=8000) # test_sample.py
from server import app
async def test_index():
_, resp = await app.asgi_client.get('/')
assert resp.status_code == 200
assert resp.json == {'message': 'hola'}
|
I also started to implement tests and discovered that the |
I think this pull request resolve this problem: sanic-org/sanic#2451 |
Is this still an issue? |
I'll update today to 22.6.2 and see if I still have these. I'll let you know! |
I tried with Sanic v22.6.2 and my tests are passed. issue resolved. |
@sl0thentr0py Can we get this issue closed? I will add a PR to update the docs to add the specific version. |
Sorry to be THAT guy, but I'm still having issues with Sanic v22.12.0. https://cyril-nicodeme.sentry.io/share/issue/36c0531d78ab462994eae3e0f6f930b6/ Looking on Sentry, I can't provide more details than what is present on the link above, but if you need any, please ask. |
Environment
How do you use Sentry?
Sentry SaaS (sentry.io)
Which SDK and version?
Sentry-sdk v1.5.2
I'm facing the same issue as #1290, but with the latest (v1.5.2) version of Sentry-sdk
This is the public link to the issue:
https://sentry.io/share/issue/0464a5d631244872a70b7afacefa01aa/
The text was updated successfully, but these errors were encountered: