-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Cloud code unable to reference Facebook auth data #1846
Comments
Does this work in 2.2.8? If it is the latter then one workaround is to do a fetch/query on request.user |
No I tried 2.2.8 and the situation is the same. |
I resolved this by wrapping my code for each cloud function in the following:
|
I've been on vacation so only just getting back to this. That is similar to what we do. I think you should be fine as username is unique. We query on request.user.id as that doesn't rely on attributes. It's strange that the username attribute is present but not the authData so definitely something wrong there. |
@antonfire just fyi, @flovilmart has made a promising pull request (#2348) to finally resolve this issue, so you may be able to take out your workaround (which doesn't work for me unfortunately) in the next version if the PR makes it in. Hopefully it gets merged soon. |
Check out #1271 for an ideal bug report. The closer your issue report is to that one, the more likely we are to be able to help, and the more likely we will be to fix the issue quickly!
Many members of the community use Stack Overflow and Server Fault to ask questions. Read through the existing questions or ask your own!
For database migration help, please file a bug report at https://parse.com/help#report
Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!
Environment Setup
Steps to reproduce
When running cloud code in parse server 2.1.6 everything works fine, upon upgrade to 2.2.10 when referencing the Facebook user id held in authdata I get an authdata undefined error. I had similar issues when I attempted to upgrade to 2.2.7, see > #1579.
I am referencing authdata in the cloud function as follows:
var currentUserFacebookID = request.user.attributes.authData.facebook.id;
As noted above this works in v2.1.6.
Logs/Trace
Elastic beanstalk logs this as:
[31merror�[39m: Uncaught internal server error. [TypeError: Cannot read property 'facebook' of undefined] TypeError: Cannot read property 'facebook' of undefined
at /var/app/current/cloud/main.js:1149:74
The text was updated successfully, but these errors were encountered: