Title: `TypeError` from aiohttp integration when explicitly passing `None` for `ClientSession`'s `trace_configs` kwarg · Issue #2229 · getsentry/sentry-python · GitHub
Open Graph Title: `TypeError` from aiohttp integration when explicitly passing `None` for `ClientSession`'s `trace_configs` kwarg · Issue #2229 · getsentry/sentry-python
X Title: `TypeError` from aiohttp integration when explicitly passing `None` for `ClientSession`'s `trace_configs` kwarg · Issue #2229 · getsentry/sentry-python
Description: How do you use Sentry? Sentry Saas (sentry.io) Version 1.27.0 Steps to Reproduce D:\>py -3.11 -m venv .venv D:\>cd .venv D:\.venv>Scripts\activate.bat (.venv) D:\.venv>pip install aiohttp sentry-sdk Collecting aiohttp Downloading aiohttp...
Open Graph Description: How do you use Sentry? Sentry Saas (sentry.io) Version 1.27.0 Steps to Reproduce D:\>py -3.11 -m venv .venv D:\>cd .venv D:\.venv>Scripts\activate.bat (.venv) D:\.venv>pip install aiohttp sentry-sd...
X Description: How do you use Sentry? Sentry Saas (sentry.io) Version 1.27.0 Steps to Reproduce D:\>py -3.11 -m venv .venv D:\>cd .venv D:\.venv>Scripts\activate.bat (.venv) D:\.venv>pip install aioht...
Opengraph URL: https://github.com/getsentry/sentry-python/issues/2229
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`TypeError` from aiohttp integration when explicitly passing `None` for `ClientSession`'s `trace_configs` kwarg","articleBody":"### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Version\n\n1.27.0\n\n### Steps to Reproduce\n\n```pycon\r\nD:\\>py -3.11 -m venv .venv\r\n\r\nD:\\>cd .venv\r\n\r\nD:\\.venv>Scripts\\activate.bat\r\n\r\n(.venv) D:\\.venv>pip install aiohttp sentry-sdk\r\nCollecting aiohttp\r\n Downloading aiohttp-3.8.4-cp311-cp311-win_amd64.whl (317 kB)\r\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 317.2/317.2 kB 3.9 MB/s eta 0:00:00\r\nCollecting sentry-sdk\r\n Using cached sentry_sdk-1.27.0-py2.py3-none-any.whl (211 kB)\r\nCollecting attrs>=17.3.0\r\n Using cached attrs-23.1.0-py3-none-any.whl (61 kB)\r\nCollecting charset-normalizer\u003c4.0,>=2.0\r\n Downloading charset_normalizer-3.1.0-cp311-cp311-win_amd64.whl (96 kB)\r\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 96.7/96.7 kB 5.4 MB/s eta 0:00:00\r\nCollecting multidict\u003c7.0,>=4.5\r\n Downloading multidict-6.0.4-cp311-cp311-win_amd64.whl (28 kB)\r\nCollecting async-timeout\u003c5.0,>=4.0.0a3\r\n Using cached async_timeout-4.0.2-py3-none-any.whl (5.8 kB)\r\nCollecting yarl\u003c2.0,>=1.0\r\n Downloading yarl-1.9.2-cp311-cp311-win_amd64.whl (60 kB)\r\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.2/60.2 kB ? eta 0:00:00\r\nCollecting frozenlist>=1.1.1\r\n Downloading frozenlist-1.3.3-cp311-cp311-win_amd64.whl (32 kB)\r\nCollecting aiosignal>=1.1.2\r\n Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)\r\nCollecting certifi\r\n Using cached certifi-2023.5.7-py3-none-any.whl (156 kB)\r\nCollecting urllib3>=1.26.11\r\n Downloading urllib3-2.0.3-py3-none-any.whl (123 kB)\r\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 123.6/123.6 kB 7.6 MB/s eta 0:00:00\r\nCollecting idna>=2.0\r\n Using cached idna-3.4-py3-none-any.whl (61 kB)\r\nInstalling collected packages: urllib3, multidict, idna, frozenlist, charset-normalizer, certifi, attrs, async-timeout, yarl, sentry-sdk, aiosignal, aiohttp\r\nSuccessfully installed aiohttp-3.8.4 aiosignal-1.3.1 async-timeout-4.0.2 attrs-23.1.0 certifi-2023.5.7 charset-normalizer-3.1.0 frozenlist-1.3.3 idna-3.4 multidict-6.0.4 sentry-sdk-1.27.0 urllib3-2.0.3 yarl-1.9.2\r\n\r\n[notice] A new release of pip available: 22.3 -> 23.1.2\r\n[notice] To update, run: python.exe -m pip install --upgrade pip\r\n\r\n(.venv) D:\\.venv>python\r\nPython 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import sentry_sdk\r\n>>> sentry_sdk.init(debug=True)\r\n [sentry] DEBUG: Setting up integrations (with default = True)\r\n [sentry] DEBUG: Did not import default integration sentry_sdk.integrations.django.DjangoIntegration: Django not installed\r\n [sentry] DEBUG: Did not import default integration sentry_sdk.integrations.flask.FlaskIntegration: Flask is not installed\r\n [sentry] DEBUG: Did not import default integration sentry_sdk.integrations.starlette.StarletteIntegration: Starlette is not installed\r\n [sentry] DEBUG: Did not import default integration sentry_sdk.integrations.fastapi.FastApiIntegration: Starlette is not installed\r\n [sentry] DEBUG: Did not import default integration sentry_sdk.integrations.bottle.BottleIntegration: Bottle not installed\r\n [sentry] DEBUG: Did not import default integration sentry_sdk.integrations.falcon.FalconIntegration: Falcon not installed\r\n [sentry] DEBUG: Did not import default integration sentry_sdk.integrations.sanic.SanicIntegration: Sanic not installed\r\n [sentry] DEBUG: Did not import default integration sentry_sdk.integrations.celery.CeleryIntegration: Celery not installed\r\n [sentry] DEBUG: Did not import default integration sentry_sdk.integrations.rq.RqIntegration: RQ not installed\r\n [sentry] DEBUG: Did not import default integration sentry_sdk.integrations.tornado.TornadoIntegration: Tornado not installed\r\n [sentry] DEBUG: Did not import default integration sentry_sdk.integrations.sqlalchemy.SqlalchemyIntegration: SQLAlchemy not installed.\r\n [sentry] DEBUG: Did not import default integration sentry_sdk.integrations.pyramid.PyramidIntegration: Pyramid not installed\r\n [sentry] DEBUG: Did not import default integration sentry_sdk.integrations.boto3.Boto3Integration: botocore is not installed\r\n [sentry] DEBUG: Did not import default integration sentry_sdk.integrations.httpx.HttpxIntegration: httpx is not installed\r\n [sentry] DEBUG: Setting up previously not enabled integration logging\r\n [sentry] DEBUG: Setting up previously not enabled integration stdlib\r\n [sentry] DEBUG: Setting up previously not enabled integration excepthook\r\n [sentry] DEBUG: Setting up previously not enabled integration dedupe\r\n [sentry] DEBUG: Setting up previously not enabled integration atexit\r\n [sentry] DEBUG: Setting up previously not enabled integration modules\r\n [sentry] DEBUG: Setting up previously not enabled integration argv\r\n [sentry] DEBUG: Setting up previously not enabled integration threading\r\n [sentry] DEBUG: Setting up previously not enabled integration aiohttp\r\n [sentry] DEBUG: Setting up previously not enabled integration redis\r\n [sentry] DEBUG: Did not enable default integration redis: Redis client not installed\r\n [sentry] DEBUG: Enabling integration logging\r\n [sentry] DEBUG: Enabling integration stdlib\r\n [sentry] DEBUG: Enabling integration excepthook\r\n [sentry] DEBUG: Enabling integration dedupe\r\n [sentry] DEBUG: Enabling integration atexit\r\n [sentry] DEBUG: Enabling integration modules\r\n [sentry] DEBUG: Enabling integration argv\r\n [sentry] DEBUG: Enabling integration threading\r\n [sentry] DEBUG: Enabling integration aiohttp\r\n [sentry] DEBUG: Enabling integration redis\r\n [sentry] DEBUG: Setting SDK name to 'sentry.python.aiohttp'\r\n\u003csentry_sdk.hub._InitGuard object at 0x000001A36AFE1010>\r\n>>> import aiohttp\r\n>>> aiohttp.ClientSession(trace_configs=None)\r\nTraceback (most recent call last):\r\n File \"\u003cstdin>\", line 1, in \u003cmodule>\r\n File \"D:\\.venv\\Lib\\site-packages\\sentry_sdk\\integrations\\aiohttp.py\", line 186, in init\r\n client_trace_configs = list(kwargs.get(\"trace_configs\", ()))\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nTypeError: 'NoneType' object is not iterable\r\n```\n\n### Expected Result\n\nPassing `None` for `trace_configs` when initializing `aiohttp.ClientSession` should not error.\n\n### Actual Result\n\n`TypeError: 'NoneType' object is not iterable` is raised, due to:\r\nhttps://github.com/getsentry/sentry-python/blob/d0f8d98c8554092ab3acc989052cb8d33ad6d374/sentry_sdk/integrations/aiohttp.py#L186 as part of:\r\nhttps://github.com/getsentry/sentry-python/blob/d0f8d98c8554092ab3acc989052cb8d33ad6d374/sentry_sdk/integrations/aiohttp.py#L178-L193 which was added in #1761.\r\n\r\nI originally encountered this through discord.py:\r\n```python-traceback\r\nTraceback (most recent call last):\r\n File \"/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/discord/client.py\", line 706, in start\r\n await self.login(token)\r\n File \"/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/discord/client.py\", line 560, in login\r\n data = await self.http.static_login(token.strip())\r\n File \"/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/discord/http.py\", line 549, in static_login\r\n self.__session = aiohttp.ClientSession(\r\n File \"/opt/hostedtoolcache/Python/3.10.10/x64/lib/python3.10/site-packages/sentry_sdk/integrations/aiohttp.py\", line 186, in init\r\n client_trace_configs = list(kwargs.get(\"trace_configs\", ()))\r\nTypeError: 'NoneType' object is not iterable\r\n```\r\nhttps://github.com/Harmon758/Harmonbot/actions/runs/5457981724/jobs/9932576322?pr=5638#step:8:22\r\nhttps://github.com/Rapptz/discord.py/blob/c448932fa0a35e347f3e963436df62f575aa740b/discord/http.py#L790-L794","author":{"url":"https://github.com/Harmon758","@type":"Person","name":"Harmon758"},"datePublished":"2023-07-04T21:10:53Z","url":"https://github.com/getsentry/sentry-python/issues/2229"}
| 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:3bf09609-bb4a-12b0-cd9b-94c01700b1fa |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 98DC:2953C9:C6E29D:1158EDD:6B043A94 |
| html-safe-nonce | 2c29c5362c7ad4500d87c0e25c0fd3d20948d33b3e5a8f29a29b3785153cb20f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OERDOjI5NTNDOTpDNkUyOUQ6MTE1OEVERDo2QjA0M0E5NCIsInZpc2l0b3JfaWQiOiI2MDUxNjY4NDIzMzE1NDQyMTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a43470a5c1bdfe7e382b36929ba76d72706dcd0ac1136002f036553e162c98a9 |
| hovercard-subject-tag | issue:1788481715 |
| 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/2229/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f699d03f4e076f7e17c3404a4f122c2a3ad217029d4779989d4f0bf0efb0f706/getsentry/sentry-python/issues/2229 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f699d03f4e076f7e17c3404a4f122c2a3ad217029d4779989d4f0bf0efb0f706/getsentry/sentry-python/issues/2229 |
| og:image:alt | How do you use Sentry? Sentry Saas (sentry.io) Version 1.27.0 Steps to Reproduce D:\>py -3.11 -m venv .venv D:\>cd .venv D:\.venv>Scripts\activate.bat (.venv) D:\.venv>pip install aiohttp sentry-sd... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Harmon758 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9185ccfefd80c1ff2d9ddcdb0cd2becf46b5a1efbbf30741a895e4bb8de25e64 |
| 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 | 06dc448a76fe4751ac1db26524aefa3aa3e889a8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width