Title: Sentry's http putrequest override breaks if url is None, while native http does not · Issue #1678 · getsentry/sentry-python · GitHub
Open Graph Title: Sentry's http putrequest override breaks if url is None, while native http does not · Issue #1678 · getsentry/sentry-python
X Title: Sentry's http putrequest override breaks if url is None, while native http does not · Issue #1678 · getsentry/sentry-python
Description: How do you use Sentry? Sentry Saas (sentry.io) Version 1.9.10 Steps to Reproduce Example code import sentry_sdk from http.client import HTTPConnection print("sending reqeust with None url before sentry_sdk.init") HTTPConnection("httpbin....
Open Graph Description: How do you use Sentry? Sentry Saas (sentry.io) Version 1.9.10 Steps to Reproduce Example code import sentry_sdk from http.client import HTTPConnection print("sending reqeust with None url before se...
X Description: How do you use Sentry? Sentry Saas (sentry.io) Version 1.9.10 Steps to Reproduce Example code import sentry_sdk from http.client import HTTPConnection print("sending reqeust with None url befo...
Opengraph URL: https://github.com/getsentry/sentry-python/issues/1678
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Sentry's http putrequest override breaks if url is None, while native http does not","articleBody":"### How do you use Sentry?\r\n\r\nSentry Saas (sentry.io)\r\n\r\n### Version\r\n\r\n1.9.10\r\n\r\n### Steps to Reproduce\r\n\r\nExample code\r\n\r\n```\r\nimport sentry_sdk\r\nfrom http.client import HTTPConnection\r\n\r\nprint(\"sending reqeust with None url before sentry_sdk.init\")\r\nHTTPConnection(\"httpbin.org\", port=443).putrequest(\"POST\", None)\r\nprint(\"OK\")\r\n\r\nsentry_sdk.init(dsn=\"\")\r\nprint(\"sending reqeust with None url after sentry_sdk.init\")\r\nHTTPConnection(\"httpbin.org\", port=443).putrequest(\"POST\", None)\r\nprint(\"OK\")\r\n```\r\n\r\nOutput:\r\n\r\n```\r\nsending reqeust with None url before sentry_sdk.init\r\nOK\r\nsending reqeust with None url after sentry_sdk.init\r\nTraceback (most recent call last):\r\n File \"/Users/cpak/projects/sentry-httplib-bug/main.py\", line 10, in \u003cmodule>\r\n HTTPConnection(\"httpbin.org\", port=443).putrequest(\"POST\", None)\r\n File \"/Users/cpak/projects/sentry-httplib-bug/.venv/lib/python3.10/site-packages/sentry_sdk/integrations/stdlib.py\", line 73, in putrequest\r\n if not real_url.startswith((\"http://\", \"https://\")):\r\nAttributeError: 'NoneType' object has no attribute 'startswith'\r\n```\r\n\r\n\r\n### Expected Result\r\n\r\nI expect Sentry's http instrumentation to not alter the behavior of the underlying code.\r\n\r\nI ran into this issue because a package I'm using ([azure-data-tables](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/tables/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 😅 \r\n\r\n### Actual Result\r\n\r\nAn `AttributeError: 'NoneType' object has no attribute 'startswith'` is raised.\r\n\r\nFWIW the native implementation has this line\r\n```\r\nurl = url or '/'\r\n```\r\n","author":{"url":"https://github.com/cpak","@type":"Person","name":"cpak"},"datePublished":"2022-10-13T15:01:58Z","url":"https://github.com/getsentry/sentry-python/issues/1678"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ee42a9be-a4cd-e10d-c1fd-1c16b64adb22 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D998:1E3D3D:339917:478B7D:6B008AD7 |
| html-safe-nonce | 2b56ebbb92f0e733346ae604c254ff2a5b50649b9945e275cb2e5718cd53f1b9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTk4OjFFM0QzRDozMzk5MTc6NDc4QjdEOjZCMDA4QUQ3IiwidmlzaXRvcl9pZCI6IjQzNTgwMDc3MTk2NjQzMjMyODciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f5a73274e20b3ef835d0999f25345f7038e1628c889394789b6fd30829231fef |
| hovercard-subject-tag | issue:1407963886 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-python/1678/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5959b9861aac85151b86ecf8fbd3113e65666823794e6083700c2fa3f30d4874/getsentry/sentry-python/issues/1678 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5959b9861aac85151b86ecf8fbd3113e65666823794e6083700c2fa3f30d4874/getsentry/sentry-python/issues/1678 |
| og:image:alt | How do you use Sentry? Sentry Saas (sentry.io) Version 1.9.10 Steps to Reproduce Example code import sentry_sdk from http.client import HTTPConnection print("sending reqeust with None url before se... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cpak |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4d3d8e50f02c1d7bf86d5acfa1d3bfe9366abd6528a6b429eb07a168429d2b61 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 137814779 |
| octolytics-dimension-repository_nwo | getsentry/sentry-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 137814779 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | db758f8e02b8257935fb03edf81a3e76eb3abd11 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width