Skip to content

auth: AuthRetryableError on a 502, 503 or 504 has httpx's generic message instead of the server's #1832

Closed

Description

@irisfield

Describe the bug

When the auth server responds with a 502, 503, 504 or one of Cloudflare's 52x codes, the AuthRetryableError that is raised carries httpx's generic text instead of the error message the server sent in the response body.

Related to supabase/supabase-js#2587.

Expected: the error message is the server's message ("upstream unavailable" in the example below). When the body is not JSON, it falls back to the HTTP reason phrase.

Reproduction

import httpx
from supabase_auth import SyncGoTrueClient

def handler(request):
    return httpx.Response(503, json={"msg": "upstream unavailable"})

client = SyncGoTrueClient(
    url="http://localhost/auth/v1",
    http_client=httpx.Client(transport=httpx.MockTransport(handler)),
)
client.sign_in_with_password({"email": "a@b.c", "password": "x"})

Raises:

supabase_auth.errors.AuthRetryableError: Server error '503 Service Unavailable' for url 'http://localhost/auth/v1/token?grant_type=password'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503

Steps to reproduce

  1. Call any auth method while the auth server returns a 503 with a JSON error body.
  2. Read the message on the raised AuthRetryableError.

Library affected

supabase_auth

Library version

supabase_auth 2.33.0

Python version

python 3.14.8

Activity

  1. added
    bug
    python
    on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    authbugpython

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions