Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version = "0.1.0"
description = ""
requires-python = ">=3.12,<4.0"
dependencies = [
"fastapi[standard]<1.0.0,>=0.114.2",
"python-multipart<1.0.0,>=0.0.7",
"fastapi[standard]>=0.116.0",
"python-multipart>=0.0.22,<1.0.0",
"email-validator<3.0.0.0,>=2.1.0.post1",
"passlib[bcrypt]<2.0.0,>=1.7.4",
"tenacity<9.0.0,>=8.2.3",
Expand All @@ -19,7 +19,7 @@ dependencies = [
# Pin bcrypt until passlib supports the latest
"bcrypt==4.0.1",
"pydantic-settings<3.0.0,>=2.2.1",
"sentry-sdk[fastapi]<2.0.0,>=1.40.6",
"sentry-sdk[fastapi]>=2.20.0",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Sentry SDK Python 2.x migration guide breaking changes

💡 Result:

Key breaking changes when migrating Sentry’s Python SDK from 1.x → 2.x (the official migration guide is here) [1]:

  • Python 2 is not supported anymore: sentry-sdk 2.x requires Python ≥ 3.6 (so Python 2.7 must stay on sentry-sdk 1.x). [1], [2]
  • Config option removals/renames:
    • with_locals removed → use include_local_variables
    • request_bodies removed → use max_request_body_size [1], [2]
  • Profiling options are no longer “experimental”:
    • Stop setting profiles_sample_rate / profiler_mode via _experiments; set them as top-level init options. [1]
  • Scopes/Hub API direction changed:
    • Hub-based APIs and some scope-manager patterns (e.g., configure_scope(), push_scope()) are deprecated in favor of global / isolation / current scopes and helpers like new_scope() / isolation_scope() / get_current_scope() / get_isolation_scope(). [1], [2]
  • Transport / ingestion changes:
    • Events are sent via the /envelope endpoint; self-hosted Sentry must be ≥ 20.6.0. [1], [2]
    • Custom transports: Transport.capture_event is deprecated → use Transport.capture_envelope (and transports should be Transport subclasses). [1]
  • API changes:
    • before_emit_metric callback signature changed to include (key, value, unit, tags). [1]
    • last_event_id() was removed in 2.0.0 (and later brought back in 2.2.0). [1], [2]

Sources: official Sentry docs migration guide [1] and the 2.0.0 release notes summary [2].


🌐 Web query:

Sentry SDK FastAPI integration 2.x compatibility changes

💡 Result:

Key 2.x changes that can affect FastAPI / Starlette users of sentry-sdk:

  • Runtime / backend compatibility

    • Python support: sentry-sdk 2.0 requires Python ≥ 3.6 (older Python must stay on 1.x). [1]
    • Self-hosted Sentry: sentry-sdk 2.0 requires Sentry ≥ v20.6.0 (SDK switched to sending via the /envelope endpoint). [1]
  • Scope / context propagation changes (important for request-scoped data)

    • Hub-based APIs and some scope helpers (e.g., configure_scope(), push_scope()) are deprecated in 2.x in favor of global / isolation / current scopes (use get_isolation_scope(), get_current_scope(), new_scope(), isolation_scope(), etc.). This can matter if you were manually managing per-request tags/user/context in FastAPI middleware or dependencies. [1]
  • FastAPI/Starlette integration behavior changes

    • (2.48.0) Middleware spans disabled by default for Django, Starlette, and FastAPI integrations. If you relied on per-middleware spans for performance analysis, you must re-enable them: FastApiIntegration(middleware_spans=True) / StarletteIntegration(middleware_spans=True). [2]
    • (2.5.0) New integration option failed_request_status_codes lets you control which HTTP response codes generate Sentry events (default is 5xx). Example:
      from sentry_sdk.integrations.starlette import StarletteIntegration
      from sentry_sdk.integrations.fastapi import FastApiIntegration
      
      sentry_sdk.init(
          integrations=[
              StarletteIntegration(failed_request_status_codes=[403, range(500, 599)]),
              FastApiIntegration(failed_request_status_codes=[403, range(500, 599)]),
          ]
      )
      ``` [3]

Address Sentry SDK 2.x breaking changes before merging.

This major version bump introduces several breaking changes confirmed by the official migration guide:

  • Config options removed: with_localsinclude_local_variables, request_bodiesmax_request_body_size
  • Deprecated APIs: Hub-based patterns (configure_scope(), push_scope()) replaced with get_isolation_scope(), get_current_scope(), new_scope()
  • FastAPI-specific: Middleware spans disabled by default in 2.48.0+; re-enable with FastApiIntegration(middleware_spans=True) if needed
  • Infrastructure requirement: Self-hosted Sentry must be ≥ v20.6.0 (SDK now sends via /envelope endpoint)

Audit the codebase for removed config options and deprecated scope/Hub APIs, then run a startup smoke test with FastAPI to confirm request handling and error reporting work as expected.

🤖 Prompt for AI Agents
In `@backend/pyproject.toml` at line 22, The dependency bump to
"sentry-sdk[fastapi]>=2.20.0" introduces breaking changes — search for usages of
the removed config keys and deprecated Hub/scope APIs and update them: replace
any client init options using with_locals with include_local_variables and
request_bodies with max_request_body_size; replace calls to configure_scope() /
push_scope() with the new get_isolation_scope(), get_current_scope(), or
new_scope() helpers where appropriate; if FastAPI middleware spans are required,
instantiate FastApiIntegration(middleware_spans=True) when creating the Sentry
integration; and verify any self-hosted Sentry endpoint expectations (envelope
endpoint /envelope) and minimum server version. After making these changes (look
for symbols like Sentry.init, configure_scope, push_scope, FastApiIntegration),
run a FastAPI startup smoke test to confirm request/error reporting works.

"pyjwt<3.0.0,>=2.8.0",
"boto3>=1.37.20",
"moto[s3]>=5.1.1",
Expand Down
Loading