Skip to content

Half installed AioHttpIntegration causes aiohttp to crash #260

@janLo

Description

@janLo

If I call:

sentry_sdk.integrations.setup_integrations(
        [sentry_sdk.integrations.aiohttp.AioHttpIntegration()])

after sentry_sdk.init() the _handle method of aiohttp.web.Application gets replaced but the integration does not get registered in the client. This causes the replaced _handle ro run into a codepath where there as a await missing. This gives an exception in every request:

ERROR:aiohttp.server:Unhandled exception                                                                                                                                                                                                                             
Traceback (most recent call last):                                                                                                                            
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 447, in start                                                                                                                                                                          
    await resp.prepare(request)                                                                                                                               
AttributeError: 'coroutine' object has no attribute 'prepare'                                                                                                                                                                                                        
/usr/local/lib/python3.7/site-packages/xxx/base.py:151: RuntimeWarning: coroutine 'Application._handle' was never awaited                              
  self._loop.run_forever()     

This will not get logged to sentry at all, because the aiohttp.server logger gets ignored by (half-)installing the integration (see #259).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions