AttributeError exception when accessing current user using Parse Server
See original GitHub issueEDIT FOR FUTURE: see https://github.com/milesrichardson/ParsePy/issues/155#issuecomment-271482650 for solution
Using Parse Server, I am encountering a crash at line 442 in datatypes.py
setattr(self, key, ParseType.convert_from_parse(key, value))
when retrieving the currently logged in user. The user object appears to be being loaded correctly, looking at both the server logs and the error page from my (Django) app.
This only happens using the self-hosted server, not the Parse service.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:11 (5 by maintainers)
Top Results From Across the Web
get method not working on Parse current User - Stack Overflow
I am making an express app with Parse. In my cloud code, I am trying to get an attribute of the current user,...
Read more >Can't get the current user in cloud code - The Parse Community
Why I can't get the current user in my cloud code? Even though I pass a header X-Parse-Session-Token, user is still {} Cloud...
Read more >Built-in Exceptions — Python 3.11.1 documentation
The built-in exception classes can be subclassed to define new exceptions; programmers are encouraged to derive new exceptions from the Exception class or...
Read more >Exception and Error Handling in Python - DataCamp
Learn how to catch and handle exceptions in Python with our step-by-step ... An error can be a syntax (parsing) error, while there...
Read more >Requests - Django REST framework
user or .auth properties. These errors originate from an authenticator as a standard AttributeError , however it's necessary that they be re-raised as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Confirming this is working on my end, thanks for such a quick fix!
@francisjervis This should be fixed now. You can install from master like
pip install git+https://github.com/milesrichardson/ParsePy
Since I included a link to this issue in a comment at the location of the fix in the code, I’m putting the solution in this comment.
The problem was that
setattr(self, key, ParseType.convert_from_parse(key, value))
was trying to set the attributeclassName
on classParseResource
, butclassName
conflicts with the existingParseResource
property:The offending code:
As far as I can see there were two solutions:
className
attribute:I chose solution 2 because it’s more “future proof” in the case that there are any other attributes that conflict with existing properties of the
ParseResource
object.As an aside, the reason this happened only with
User
objects is thatUser
is derived fromParseResource
, which has the conflictingclassName
property, but all other objects are derived fromObject
, which does not have the conflictingclassName
property.