code 107: Received an error with invalid JSON from Parse
I am just trying to get familiar with parse and parse server. Therefor I just tried to write a little Cloud function:
Parse.Cloud.define("Trivial", function(request,response){
var User = new Parse.Object("Mlad");
User.set("name","Frank");
User.save().then(function(result){
console.log(result);
response.success("saved");
}, function(error){
console.log("save failed!");
response.error(error);
});
});
In my eyes this code is syntactically correct but doesn't return my desired result. Instead it delivers an error code 107: Received an error with invalid JSON from Parse. The exacte error code is the following:
{ "code": 141, "error": { "code": 107, "message": "Received an error with invalid JSON from Parse: <!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL /classes/Mlad was not found on this server.</p>\n<hr>\n<address>Apache/2.4.7 (Ubuntu) Server at localhost Port 80</address>\n</body></html>\n" } }
I called the function in the following way: http://localhost:1337/functions/Trivial
So this should be correct. I don't understand why save fail (which is also printed in console ^^). A path /classes/Mlad does not exist on port 80 nor on parse (port 1337). Calling a usual POST Request /classes/Mlad works correctly.
Did I misconfiguraed something so that parse server routes everything to my apache instead of parse-server?
You're missing the mount path, which by default is /parse... So the serverURL would be http://localhost:1337/parse/functions/Trivial.
@gfosco parse-server-example running on http://localhost:1337/ so the server URL is working correctly... My request is also handled correctly but the .save method somehow doesn't handle it correctly
Problem was that serverURL needs to be set correctly