Open
Description
How do you use Sentry?
Sentry Saas (sentry.io)
Version
2.33.0
Steps to Reproduce
sentry_sdk.init(
dsn=os.getenv("SENTRY_DSN"),
environment=APP_ENV,
release=APP_VERSION,
send_default_pii=True,
integrations=[
FastApiIntegration(
failed_request_status_codes={*range(400, 600)}
)
]
)
app = FastAPI(
title="My Api",
version=APP_VERSION,
)
@app.get("/sentry-debug")
async def trigger_error():
raise HTTPException(status_code=403, detail="Forbidden cannot be updated")
This is not sending errors in the 400-500 range to Sentry, even though the parameter is {*range(400, 600)}
. I also tried {403, *range(400, 600)}
, but the error does not get sent.
However, if I change status_code
to anything in the 500-600 range, it works
Expected Result
I expected to see 4xx errors on Sentry after setting the option failed_request_status_codes
as described on the documentation here: https://docs.sentry.io/platforms/python/integrations/fastapi/#options
Actual Result


But for 403, nothing new on Sentry:


Metadata
Metadata
Assignees
Labels
Type
Projects
Status