You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
falcon integration fails when response.status is an int #8138
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.10,<3.13"
# dependencies = [
# "falcon==3.1.3",
# "sentry-sdk==2.73.0",
# ]
# ///
"""Reproduce sentry-sdk 2.73.0 failing on a valid Falcon integer response status.
Run: uv run --script reproduce-sentry-falcon-status.py
Expected: the baseline returns 404; the Sentry-enabled request raises AttributeError.
"""
from __future__ import annotations
import falcon.testing
import sentry_sdk
from sentry_sdk.integrations.falcon import FalconIntegration
class Resource:
def on_get(self, request: falcon.Request, response: falcon.Response) -> None:
raise LookupError('missing item')
def handle_missing_item(request, response, error, params):
response.status = 404
response.text = 'Not found'
app = falcon.App()
app.add_route('/', Resource())
app.add_error_handler(LookupError, handle_missing_item)
client = falcon.testing.TestClient(app)
result = client.simulate_get('/')
assert result.status_code == 404
print('Without Sentry: 404, as expected', flush=True)
sentry_sdk.init(
dsn='https://public@example.invalid/1',
default_integrations=False,
integrations=[FalconIntegration()],
transport=lambda event: None,
)
print('With Sentry: making the same request...', flush=True)
client.simulate_get('/')
I'm not sure which versions of falcon are supposed to be supported by the integration, but since version 3, Response.status is allowed to be a string or an int (or a http.HTTPStatus which acts as an int), and since version 4 the same holds for HTTPError/HTTPStatus objects.
Using this unconditionally would break falcon 2 usage; given that the Sentry Integration docs only mention version 3 that might not be an issue, and falcon 3.0.0 was released 5 years ago.
Expected Result
no error
Actual Result
AttributeError: 'int' object has no attribute 'startswith'
Activity
linear-code commentedon Oct 27, 2026
PY-3048
jap commentedon Oct 27, 2026
(I have a patch which I'm finalising right now)
fix(falcon): Handle integer HTTP statuses (getsentry#8138)
fix(falcon): Handle integer HTTP statuses (getsentry#8138)
fix(falcon): Handle integer HTTP statuses (getsentry#8139)