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
{{ message }}
Repository navigation
Sentry's http putrequest override breaks if url is None, while native http does not #1678
import sentry_sdk
from http.client import HTTPConnection
print("sending reqeust with None url before sentry_sdk.init")
HTTPConnection("httpbin.org", port=443).putrequest("POST", None)
print("OK")
sentry_sdk.init(dsn="")
print("sending reqeust with None url after sentry_sdk.init")
HTTPConnection("httpbin.org", port=443).putrequest("POST", None)
print("OK")
Output:
sending reqeust with None url before sentry_sdk.init
OK
sending reqeust with None url after sentry_sdk.init
Traceback (most recent call last):
File "/Users/cpak/projects/sentry-httplib-bug/main.py", line 10, in <module>
HTTPConnection("httpbin.org", port=443).putrequest("POST", None)
File "/Users/cpak/projects/sentry-httplib-bug/.venv/lib/python3.10/site-packages/sentry_sdk/integrations/stdlib.py", line 73, in putrequest
if not real_url.startswith(("http://", "https://")):
AttributeError: 'NoneType' object has no attribute 'startswith'
Expected Result
I expect Sentry's http instrumentation to not alter the behavior of the underlying code.
I ran into this issue because a package I'm using (azure-data-tables) apparently tries to send requests with a None url, i.e. I don't really have any control over this. It worked locally but not on our remote servers, which turned out to be because we have Sentry running on those servers 😅
Actual Result
An AttributeError: 'NoneType' object has no attribute 'startswith' is raised.
changed the title [-]Sentry's http putrequest override breaks if url is None, while native httplib does not[/-][+]Sentry's http putrequest override breaks if url is None, while native http does not[/+]on Oct 13, 2022
Activity
[-]Sentry's http putrequest override breaks if url is None, while native httplib does not[/-][+]Sentry's http putrequest override breaks if url is None, while native http does not[/+]fix(integrations): Fix http putrequest when url is None
fix(integrations): Fix http putrequest when url is None
fix(integrations): Fix http putrequest when url is None (#1693)