Zack Shapiro
Zack Shapiro

Reputation: 6998

node.js Error generating response. TypeError: response.json is not a function

In my node app, I'm trying to return a simple object and getting this error in my console:

Error generating response. TypeError: response.json is not a function

code in my messaging.js file :

module.exports = {
    getConfig: function(res) {
        getConfig(res);
    }
};

function getConfig(response) {    
    response.json({
      enabledForAll: false,
      limit: 100
    });
};

In main.js

const messaging = require("./modules/messaging.js");
Parse.Cloud.define("getConfig", messaging.getConfig);

Any advice? Thanks

Upvotes: 0

Views: 625

Answers (1)

Cody Geisler
Cody Geisler

Reputation: 8617

A parse FunctionResponse only has two properties. success and error.

Additionally, the data portion of the define callback has two function inputs, FunctionRequest and FunctionResponse, so you may need something like function(req,res){ res.success();}

Upvotes: 1

Related Questions