Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Identity model: Get user failed with ValidationError #155

@symeneses

Description

@symeneses

Description

get_user fails with ValidationError exception:

File /opt/homebrew/Caskroom/miniconda/base/lib/python3.8/site-packages/gotrue/_sync/api.py:498, in SyncGoTrueAPI.get_user(self, jwt)
    496 url = f"{self.url}/user"
    497 response = self.http_client.get(url, headers=headers)
--> 498 return User.parse_response(response)

File /opt/homebrew/Caskroom/miniconda/base/lib/python3.8/site-packages/gotrue/types.py:27, in BaseModelFromResponse.parse_response(cls, response)
     24 @classmethod
     25 def parse_response(cls: Type[T], response: Response) -> T:
     26     check_response(response)
---> 27     return cls.parse_obj(response.json())

File /opt/homebrew/Caskroom/miniconda/base/lib/python3.8/site-packages/pydantic/main.py:521, in pydantic.main.BaseModel.parse_obj()

File /opt/homebrew/Caskroom/miniconda/base/lib/python3.8/site-packages/pydantic/main.py:341, in pydantic.main.BaseModel.__init__()

ValidationError: 1 validation error for User
identities -> 0 -> id
  value is not a valid uuid (type=type_error.uuid)

The response before being parsed contains 'identities': [{'id': '115235693124164205279', 'user_id': 'cbaa0f9e-f062-4ffb-baf3-79c533df007e', 'identity_data' .... .

Checking the type for id, it's defined as UUID but the type in gotrue-js is string.

How to reproduce the error

import os
from supabase import create_client, Client

url: str = os.environ.get("SUPABASE_URL")
key: str = os.environ.get("SUPABASE_KEY")
supabase: Client = create_client(url, key)

token=YOUR_TOKEN

supabase.auth.api.get_user(jwt=token)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions