Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with current user route and its Pydantic model #1000

Closed
JimScope opened this issue May 23, 2022 · 5 comments
Closed

Error with current user route and its Pydantic model #1000

JimScope opened this issue May 23, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@JimScope
Copy link
Contributor

Describe the bug

In beanie the id field returns null when the Current User path is used. Like nested documents.

To Reproduce

Steps to reproduce the behavior:

Expected behavior

{"id":"d23d8h293dj3298","email":"user@example.com","is_active":true,"is_superuser":false,"is_verified":false,"messages":[{"foo": "bar"}]}

but the id field and other custom field return null

{"id":null,"email":"user@example.com","is_active":true,"is_superuser":false,"is_verified":false,"messages":null}

Configuration

  • Python version : 3.10.4
  • FastAPI version : 0.78.0
  • FastAPI Users version : 10.0.4

FastAPI Users configuration

None.

Additional context

None.

@JimScope JimScope added the bug Something isn't working label May 23, 2022
@frankie567
Copy link
Member

Hi @JimScope!

Could you show us how you configured the Beanie model and the Pydantic schemas?

@JimScope
Copy link
Contributor Author

Thanks to reply @frankie567 . I have not changed anything from the example that is in the repo. Attached the MongoDB Atlas database document
{"_id":{"$oid":"628bb94e4c07ea5954e9a693"},"email":"user@example.com","hashed_password":"$2b$12$qX64ExUF0r.wN4Pgc2qpRO3e6a/NQZST84lq1qDOiiw2cwZVvq72K","is_active":true,"is_superuser":false,"is_verified":false}

@JimScope
Copy link
Contributor Author

As you can see the id value exists in the document, however it is not retrieved when the /me path is used. Returning a null value

@frankie567
Copy link
Member

After checking, the id is indeed null. I'll investigate, thank you for reporting!

@frankie567
Copy link
Member

Should be fixed in v10.0.5 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants