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

Not able to run javascript SDK api's from the parse-server cloud code. #762

Closed
sekharrockz opened this issue Mar 2, 2016 · 7 comments
Closed

Comments

@sekharrockz
Copy link

Parse.Cloud.beforeSave("test", function(request, response) {
var GameScore = Parse.Object.extend("GameScore");
var gameScore = new GameScore();
gameScore.set("score", 1337);
gameScore.set("playerName", "Sean Plott");
gameScore.set("cheatMode", false);
gameScore.save(null, {
success: function(gameScore) {
alert('New object created with objectId: ' + gameScore.id);
response.success("done");
},
error: function(gameScore, error) {
alert('Failed to create new object, with error code: ' + error.message);
response.error();
}
});
});

Before save is getting called, but the Game Score object is not getting added,

@sekharrockz
Copy link
Author

Can anyone reply to this ?

@drew-gross
Copy link
Contributor

Can you provide some more information? What are your server settings? What is the response to your request? Have you tried removing the alerts?

@sekharrockz
Copy link
Author

I didt try removing alerts, but still I guess this will not work. Is master key required while using JavaScript SDK API ?

@drew-gross
Copy link
Contributor

Inside Cloud Code, the JS SDK is initialized automatically. Outside Cloud Code, you probably should not use the master key without a good reason, and you definitely should not send the master key to your users.

@sekharrockz
Copy link
Author

How do we need to use masterkey : true while using JavaScript SDK

@drew-gross
Copy link
Contributor

You do that in the options of your query.

@drew-gross
Copy link
Contributor

No response in many days, closing.

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