Cloud Code not working properly
I have a cloud code running on my parse-server. Some requests just work fine and with no problems, but some requests return weird errors.
So I have a function which performs a query on the database and returns the result. And when I try to get the result the following error occurs:
107: 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/_User was not found on this server.</p>\n<hr>\n<address>Apache/2.4.10 (Debian) Server at localhost Port 80</address>\n</body></html>\n'
Another funny thing is that request.user.id seems to return a different objectId than the real one of the user.
I could not figure out a problem with my code, because it worked fine on parse.com.
That error message is coming from an Apache server running on port 80. Are you making a connection to the wrong address or port?... Take a look and make sure your server configuration is correct, and please provide code and details around a specific issue you're having.
As I said, the other functions work fine and return responses so I obviously have the right configuration.
result_query.find({ ... at this function the error occurs. (Normal query made with new Parse.Query("_User"))
The other error with request.user.id happens with following code:
Parse.Cloud.useMasterKey();
...
var queryForVipStatus = new Parse.Query("UserBarInfo");
queryForVipStatus.equalTo("user", {
__type: "Pointer", className: "_User", objectId: request.user.id
}).first({ ...
at this point the function first(... ) does not return a thing because the id is wrong.
You must troubleshoot this. Why is an apache server handling this request instead of a parse-server?
Did you set serverURL parameter correctly? by default it is set to api.parse.com/1
As this is cloud code, I don't think you have to set this value. But I tried doing so in the ParseServer({ ... }) initializer and on top of my main cloud code file Parse.serverURL = 'http://localhost:1337/parse';
But it still has the same error. And I don't understand why my apache server should be the problem here.
Hi @applemarkus, did manage to get a solution to this problem? I'm experiencing the same thing.
yeah, I had cloned the parse-example-server a while ago and at this time there was no serverURL parameter.
Thanks @applemarkus, that worked :)