Skip to content

Cloud Code not working properly #569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
petritz opened this issue Feb 22, 2016 · 8 comments
Closed

Cloud Code not working properly #569

petritz opened this issue Feb 22, 2016 · 8 comments

Comments

@petritz
Copy link

petritz commented Feb 22, 2016

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.

@gfosco
Copy link
Contributor

gfosco commented Feb 22, 2016

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.

@petritz
Copy link
Author

petritz commented Feb 22, 2016

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.

@gfosco
Copy link
Contributor

gfosco commented Feb 22, 2016

You must troubleshoot this. Why is an apache server handling this request instead of a parse-server?

@gfosco gfosco closed this as completed Feb 22, 2016
@merowinger92
Copy link
Contributor

Did you set serverURL parameter correctly? by default it is set to api.parse.com/1

@petritz
Copy link
Author

petritz commented Feb 23, 2016

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.

@jsmcgd
Copy link

jsmcgd commented Mar 7, 2016

Hi @applemarkus, did manage to get a solution to this problem? I'm experiencing the same thing.

@petritz
Copy link
Author

petritz commented Mar 7, 2016

yeah, I had cloned the parse-example-server a while ago and at this time there was no serverURL parameter.

@jsmcgd
Copy link

jsmcgd commented Mar 8, 2016

Thanks @applemarkus, that worked :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants