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

Parse server - cloud code save object does not respond. #1694

Closed
lukelan opened this issue May 3, 2016 · 2 comments
Closed

Parse server - cloud code save object does not respond. #1694

lukelan opened this issue May 3, 2016 · 2 comments

Comments

@lukelan
Copy link

lukelan commented May 3, 2016

Environment Setup

Environment 1 - Local :
- MacOS 10.11.2
- latest parse server 2.2.7, express 4.13.4.
- DB: mongoDB on AWS
Environment 2 - AWS : same config and DB with local
- AWS ELB (t2-medium - Amazon Linux AMI 2016.03.0)
- latest parse server 2.2.7, express 4.13.4. (same code with local. deploy using "eb deploy").
- DB: mongoDB on AWS (same DB with local)

Result:

Environment 1 - Local :
- Find object [OK]
- Increase & Save [OK]
- Respond to client around 0-2 second

Environment 2 - AWS :
- Find object [OK]
- Increase & Save [NOT OK]
- Respond to client: not respond and timeout after 1 minute.
nginx access log:
10.0.2.69 - - [03/May/2016:13:40:15 +0000] "POST /parse/functions/test HTTP/1.1" 499 0 "-" "curl/7.43.0" "171.233.241.183"

Steps to reproduce

Follow this one http://stackoverflow.com/questions/36945845/parse-server-cloud-code-save-object but no luck.

Code:

var SaveObject = Parse.Object.extend("UserProfile");
var saveObject = new Parse.Query(SaveObject);
saveObject.equalTo("objectId", request.params.objectId);
saveObject.first({
useMasterKey: true,
success: function(Objects) {
console.log("Successfully retrieved");
Objects.save(null, {
useMasterKey: true,
success: function(object) {
console.log("Start Save 2 Successfully");
object.increment("noteRating");
object.save();
console.log("Cloud Code: User note rating has increased by 1.", object);
status.success('Cloud Code: User note rating has increased by 1.');
}
});
}
});

Logs/Trace

Environment 1 - Local:

Successfully retrieved
Start Save 2 Successfully
Cloud Code: User note rating has increased by 1. ParseObjectSubclass { className: 'UserProfile', _objCount: 17, id: '1GTlCTiNC4' }
response: {
"response": {
"result": "Cloud Code: User note rating has increased by 1."
}
}

Environment 2 - AWS :
Successfully retrieved -> stuck

Important Note:

Make several request, The result is random. noteRating is increased and saved around 50% after random amount of time. All requests were time out.

Please help!!!

@drew-gross
Copy link
Contributor

You are returning from the cloud code function while the save() call is still processing. Use .save().then(...) or a success callback. See the docs for more info.

@lukelan
Copy link
Author

lukelan commented Jul 28, 2016

thank. It worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants