Title: [litestar] AnnotedValue partition error · Issue #4882 · getsentry/sentry-python · GitHub
Open Graph Title: [litestar] AnnotedValue partition error · Issue #4882 · getsentry/sentry-python
X Title: [litestar] AnnotedValue partition error · Issue #4882 · getsentry/sentry-python
Description: How do you use Sentry? Sentry Saas (sentry.io) Version 2.39.0 Steps to Reproduce Enable litestar sentry sdk integration Throw error and is catched by the sentry sdk JWT authentication breaks Error in JWT autentication, after an exception...
Open Graph Description: How do you use Sentry? Sentry Saas (sentry.io) Version 2.39.0 Steps to Reproduce Enable litestar sentry sdk integration Throw error and is catched by the sentry sdk JWT authentication breaks Error ...
X Description: How do you use Sentry? Sentry Saas (sentry.io) Version 2.39.0 Steps to Reproduce Enable litestar sentry sdk integration Throw error and is catched by the sentry sdk JWT authentication breaks Error ...
Opengraph URL: https://github.com/getsentry/sentry-python/issues/4882
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[litestar] AnnotedValue partition error","articleBody":"### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Version\n\n2.39.0\n\n### Steps to Reproduce\n\n1. Enable litestar sentry sdk integration\n2. Throw error and is catched by the sentry sdk\n3. JWT authentication breaks\n\nError in JWT autentication, after an exception thrown and catched by the litestar sentry sdk integration:\n```\nTraceback (most recent call last):\n File \"litestar/middleware/_internal/exceptions/middleware.py\", line 158, in __call__\n await self.app(scope, receive, capture_response_started)\n File \"litestar/_asgi/asgi_router.py\", line 100, in __call__\n await asgi_app(scope, receive, send)\n File \"litestar/middleware/authentication.py\", line 87, in __call__\n auth_result = await self.authenticate_request(ASGIConnection(scope))\n File \"litestar/security/jwt/middleware.py\", line 267, in authenticate_request\n encoded_token = auth_header.partition(\" \")[-1]\nAttributeError: 'AnnotatedValue' object has no attribute 'partition'\n```\n\nI suspect the sentry sdk replaces some values `AnnotatedValue` and this leads to an error in the JWT auth of the litestar framework here:\n\nhttps://github.com/litestar-org/litestar/blob/a733629e86a302a957d8ebb58df30ba4cf3ecf3d/litestar/security/jwt/middleware.py#L268\n```\n auth_header = connection.headers.get(self.auth_header) or connection.cookies.get(self.auth_cookie_key)\n if not auth_header:\n raise NotAuthorizedException(\"No JWT token found in request header or cookies\")\n encoded_token = auth_header.partition(\" \")[-1]\n return await self.authenticate_token(encoded_token=encoded_token, connection=connection)\n```\n\nThe litestar framework suggests this is a bug that has to be fixed in sentry sdk:\nhttps://github.com/litestar-org/litestar/issues/3853\n\n### Expected Result\n\nSentry SDK integration does not break JWT authentication middleware.\nNo exception for an `AnnotatedValue` is thrown.\n\n### Actual Result\n\nSentry SDK for litestar breaks the JWT authentication middleware.","author":{"url":"https://github.com/0asys","@type":"Person","name":"0asys"},"datePublished":"2025-10-03T07:29:46Z","url":"https://github.com/getsentry/sentry-python/issues/4882"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e9c19e6b-4558-6fe4-7079-8b96940da8ab |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E61C:1D7628:21FFBE:2DB6D4:6B00856D |
| html-safe-nonce | 0ceffe758b0910eb7474eb22d2ace8a4934629f32055575e75bf9d70c455e207 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjFDOjFENzYyODoyMUZGQkU6MkRCNkQ0OjZCMDA4NTZEIiwidmlzaXRvcl9pZCI6IjU2MjU0NTQzMzgyNDA0NDc4NTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 01bcedc8cee0c43dee70eac75bdbcf873f81f05053f4b8792d9f41b98541aa0d |
| hovercard-subject-tag | issue:3480105877 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-python/4882/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b185ff2e620bee588e8708a9de844aeb4802d1c17f9b5957f5c64ca9066c1940/getsentry/sentry-python/issues/4882 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b185ff2e620bee588e8708a9de844aeb4802d1c17f9b5957f5c64ca9066c1940/getsentry/sentry-python/issues/4882 |
| og:image:alt | How do you use Sentry? Sentry Saas (sentry.io) Version 2.39.0 Steps to Reproduce Enable litestar sentry sdk integration Throw error and is catched by the sentry sdk JWT authentication breaks Error ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 0asys |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4d3d8e50f02c1d7bf86d5acfa1d3bfe9366abd6528a6b429eb07a168429d2b61 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 137814779 |
| octolytics-dimension-repository_nwo | getsentry/sentry-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 137814779 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | db758f8e02b8257935fb03edf81a3e76eb3abd11 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width