Skip to content

AttributeError for 'NoneType' Object has no attribute 'url' #2728

Closed

Description

@kevinchai0

How do you use Sentry?

Sentry Saas (sentry.io)

Version

1.27.0

Steps to Reproduce

After upgrading our Sentry SDK from 1.5.11 to 1.28.1, we're noticing a bug that was introduced in version 1.27.0.

This is the PR that added the code that we're encountering errors on : 0245011#diff-fcd5f0e16a3c89f23d45675191f19d41ae8bbc0c24f1c414e854cefbd6e87ef3

Expected Result

No errors when running when attempting to access url.

Actual Result

AttributeError for 'NoneType' Object has no attribute 'url' with the following stack trace:

File "/var/lib/conda/envs/nextdoor3/lib/python3.11/site-packages/ddtrace/contrib/aiohttp/patch.py", line 112, in _traced_clientsession_request
    resp = await func(*args, **kwargs)  # type: aiohttp.ClientResponse


           
^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
File "/var/lib/conda/envs/nextdoor3/lib/python3.11/site-packages/aiohttp/client.py", line 500, in _request
    await trace.send_request_start(method, url.update_query(params), headers)
  
File "/var/lib/conda/envs/nextdoor3/lib/python3.11/site-packages/aiohttp/tracing.py", line 356, in send_request_start
    return await self._trace_config.on_request_start.send(
           
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
File "/var/lib/conda/envs/nextdoor3/lib/python3.11/site-packages/aiosignal/__init__.py", line 36, in send
    await receiver(*args, **kwargs)  # type: ignore
    
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
File "/var/lib/conda/envs/nextdoor3/lib/python3.11/site-packages/sentry_sdk/integrations/aiohttp.py", line 216, in on_request_start
    span.set_data("url", parsed_url.url)
                         
^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'url'

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Feb 12, 2024
  2. sentrivana commented on Feb 14, 2024

    @sentrivana
    Collaborator

    Hey @kevinchai0, thanks for reporting this. This is still broken in 1.40.4; we explicitly set the URL to None if we fail to parse it and then anyway try to access the parsed components. We'll fix this.

  3. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Feb 14, 2024
  4. self-assigned this
    on Feb 14, 2024
  5. ghost added on Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions