Since instrumenting my Django application, I started seeing these errors:
[ERROR] Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 411, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/newrelic/api/asgi_application.py", line 357, in nr_async_asgi
return await coro
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/newrelic/common/async_proxy.py", line 124, in throw
return self.__wrapped__.throw(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/newrelic/api/asgi_application.py", line 69, in __call__
return await self.app(scope, receive, self.send_inject_browser_agent)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/channels/routing.py", line 62, in __call__
return await application(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sentry_sdk/integrations/django/asgi.py", line 101, in sentry_patched_asgi_handler
return await middleware(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sentry_sdk/integrations/asgi.py", line 144, in _run_asgi3
return await self._run_app(scope, receive, send, asgi_version=3)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sentry_sdk/integrations/asgi.py", line 235, in _run_app
raise exc from None
File "/usr/local/lib/python3.11/site-packages/sentry_sdk/integrations/asgi.py", line 230, in _run_app
return await self.app(
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/newrelic/api/asgi_application.py", line 307, in nr_async_asgi
return await wrapped(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/asgi.py", line 170, in __call__
await self.handle(scope, receive, send)
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/asgi.py", line 216, in handle
task.result()
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/asgi.py", line 195, in process_request
await self.send_response(response, send)
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/asgi.py", line 357, in send_response
await send(
File "/usr/local/lib/python3.11/site-packages/sentry_sdk/integrations/asgi.py", line 223, in _sentry_wrapped_send
return await send(event)
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/newrelic/api/asgi_application.py", line 177, in send_inject_browser_agent
content_length = int(header_value)
^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
Description
This error occurs only on some requests.
Expected Behavior
No error happening, which was the case before I installed the SDK.
This looks like it's a bug in our asgi wrapper browser injection instrumentation. It doesn't handle the case where there is no content-length header. I've opened a PR to fix this issue.
Since instrumenting my Django application, I started seeing these errors:
Description
This error occurs only on some requests.
Expected Behavior
No error happening, which was the case before I installed the SDK.
Troubleshooting or NR Diag results
Steps to Reproduce
sentry_sdk
Your Environment
Run command:
Runtime Name: CPython Version: 3.11.9(3.11.9 (main, May 14 2024, 06:28:33) [GCC 12.2.0])
Packages
Additional context