Skip to content

fix(auth): allow listeners to unsubscribe during notification - #1643

Open
hsusul wants to merge 1 commit into
supabase:mainfrom
hsusul:fix/auth-listener-unsubscribe
Open

hsusul wants to merge 1 commit into
supabase:mainfrom
hsusul:fix/auth-listener-unsubscribe

Conversation

@hsusul

@hsusul hsusul commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #1642.

An auth listener calling its own unsubscribe() during sign_out() mutates the live subscriber dictionary, raising RuntimeError and preventing later listeners from receiving the event. Snapshot the subscribers before dispatch in both clients so the current notification completes and the removed listener stays absent from subsequent events.

Adds public-API regression tests for sync and async clients; sync files were generated with the package's unasync script.

Validation (Python 3.13.12):

  • Both regression tests failed with the dictionary-mutation error on upstream bb7ecc5, then passed with the fix.
  • Full auth suite: 166 passed, with repository Docker Compose services. Used an isolated Compose project and omitted the database's host-port mapping to avoid an existing local port conflict.
  • Package mypy, Ruff lint/format checks, and git diff --check passed.

cc @olirice @silentworks

@hsusul
hsusul requested review from a team and o-santi as code owners September 16, 2026 02:33
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.

Auth listener unsubscribing during notification makes sign_out raise RuntimeError

1 participant