Why does Parse.Config return undefined?

Parse.com recently announced the Parse.Config feature. However, in cloud code, trying to access Parse.Config always returns undefined.

Parse.Cloud.define("search", function(req, res) { Parse.Config.get().then(function(config) { // This line is never reached. }); } 

Did I do something wrong?

+7
source share
3 answers

Your cloud code probably works with an old version of the SDK that does not yet support Parse Config.

You can install the SDK version for use as follows:

  • Open a terminal, cd to your project directory
  • Run parse jssdk 1.3.0
  • Cancel your code

This will install the SDK version used by your code for v1.3.0 from the SDK for analysis and Parse Config.

+4
source share

This method works with Parse SDK 1.3.0:

 Parse.Cloud.define("getConfig", function(request, response) { var config_name = request.params.config_name; Parse.Config.get().then(function(config) { console.log(config.get(config_name)); }).then(function() { response.success('Success'); }, function(error) { response.error(error); }); }); 
+1
source share

I think they just did not implement Parse.Config in CloudCode right now. Your code seems correct to me. I myself experienced this and ran into the same problem.

0
source share

All Articles