Skip to content

Reproduction for sentry-python#5274#5

Open
sl0thentr0py wants to merge 1 commit intomainfrom
repro/sentry-python-5274
Open

Reproduction for sentry-python#5274#5
sl0thentr0py wants to merge 1 commit intomainfrom
repro/sentry-python-5274

Conversation

@sl0thentr0py
Copy link
Member

Summary

  • Reproduction for Django ASGI send_default_pii triggering SynchronousOnlyOperation
  • When running Django under ASGI with send_default_pii=True, Sentry's Django integration calls request.user.is_authenticated synchronously in the ASGI event processor
  • On Django 5.x this triggers lazy session-backed user resolution in an async context and raises SynchronousOnlyOperation

Issue: getsentry/sentry-python#5274

How to run

cd sentry-python/5274
uv sync
uv run python manage.py migrate
uv run python manage.py createsuperuser --username admin --email admin@example.com
uv run uvicorn asgi:application --host 127.0.0.1 --port 8000

Then:

  1. Go to http://127.0.0.1:8000/admin/ and log in
  2. Visit http://127.0.0.1:8000/
  3. Check the console for SynchronousOnlyOperation error

🤖 Generated with Claude Code

Django ASGI: send_default_pii triggers request.user.is_authenticated
sync access, causing SynchronousOnlyOperation on Django 5.x.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant