Skip to content

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

Closed

Description

@sekharrockz

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,

Activity

  1. sekharrockz commented on Mar 2, 2016

    @sekharrockz
    Author

    Can anyone reply to this ?

  2. drew-gross commented on Mar 2, 2016

    @drew-gross
    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?

  3. sekharrockz commented on Mar 3, 2016

    @sekharrockz
    Author

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

  4. drew-gross commented on Mar 3, 2016

    @drew-gross
    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.

  5. sekharrockz commented on Mar 5, 2016

    @sekharrockz
    Author

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

  6. drew-gross commented on Mar 5, 2016

    @drew-gross
    Contributor

    You do that in the options of your query.

  7. drew-gross commented on Mar 30, 2016

    @drew-gross
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions