Skip to content

Error when explicitly passing trace_configs=None to aiohttp.ClientSession #2233

@wookie184

Description

@wookie184

How do you use Sentry?

Self-hosted/on-premise

Version

1.27.0

Steps to Reproduce

With the aiohttp integration, use aiohttp.ClientSession with trace_configs explicitly passed as None

import asyncio
import sentry_sdk
import aiohttp

sentry_sdk.init()

async def main():
    async with aiohttp.ClientSession(trace_configs=None) as session:
        pass

asyncio.run(main())

Expected Result

No error (as in 1.26.0)

Actual Result

An error is raised:

Traceback (most recent call last):
  File "C:\Users\wookie184\Documents\GitHub\bot\hello.py", line 11, in <module>
    asyncio.run(main())
  File "C:\Users\wookie184\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\wookie184\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\wookie184\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\wookie184\Documents\GitHub\bot\hello.py", line 8, in main
    async with aiohttp.ClientSession(trace_configs=None) as session:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\wookie184\AppData\Local\pypoetry\Cache\virtualenvs\bot-hu2rt1Uv-py3.11\Lib\site-packages\sentry_sdk\integrations\aiohttp.py", line 186, in init        
    client_trace_configs = list(kwargs.get("trace_configs", ()))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not iterable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions