-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Cloud Code and SSL #1695
Comments
Have you tried setting your serverURL to be an HTTPS url? |
I have and it turns out most other functions are working as expected. It seems that this particular function is where the timeout issue is occurring. This was working well before recent updates: Parse.Cloud.define('isAdmin', function(request, response){
var adminRoleQuery = new Parse.Query(Parse.Role);
adminRoleQuery.equalTo('name', 'Admin');
adminRoleQuery.equalTo('users', request.user);
return adminRoleQuery.first({ useMasterKey: true }).then(function(adminRole) {
if (!adminRole) {
throw new Error('Not an admin');
} else {
throw new response.success(true);
}
});
}); |
What problem are you seeing? Incorrect results? Crash? Can you post some server logs? |
That's the problem: I'm not receiving any errors at all. The browser simply times out after trying to call that particular function and claims that it failed to load the resource. Some other functions are working as expected, though. |
How about server logs? Or MongoDB logs? Right now I don't have enough information to debug this. |
This is the relevant line in the log. So it appears that the function is being called, but it never returns any sort of response.
|
Is this for users that are admins, or users that aren't? I see you aren't doing anything with the response in the catch block or in the "Not an admin" branch. |
I'm trying to determine if the current user is an Admin. It seems the issue is with the query itself. This doesn't log anything to the console, even if I remove the query constraints: Parse.Cloud.define('isAdmin', function(request, response){
var adminRoleQuery = new Parse.Query(Parse.Role);
adminRoleQuery.equalTo('name', 'Admin');
adminRoleQuery.equalTo('users', request.user);
adminRoleQuery.first({ useMasterKey: true }).then(function(adminRole) {
console.log('isAdmin fired succesfully');
});
}); |
Once I add the error handler to the function, I get this:
My serverURL is set correctly as https://localhost:****/parse . |
That seems to indicate some type of network error, yes. I don't I'll be able to help you, though, without knowing your exact setup, how you are doing SSL termination, and etc. |
If you have the following still in your code: if (!adminRole) {
throw new Error('Not an admin');
} else {
throw new response.success(true);
} I'm thinking you don't want to if (!adminRole) {
throw new Error('Not an admin');
} else {
response.success(true);
} |
It works fine when I run the server without https alongside the https and set the serverURL to http:// Are there any reasons that I would be able access everything fine over https, but CloudCode functions can't connect to the Parse API? |
Hello @cheesykyle i have the same problem my app only connect to my server with http protocol ? Regards |
If you're using a self signed certificate and/or working in a local environment and using https, you may find cloud code functions aren't working, see this thread: #411 This is due to using a self-signed certificate. Place this in your development environment index.js file
|
I had the same problem. This is my set up.
This is how i fixed it.
It appears that the connection (HTTPS) from the client (web, mobile) to the parse server is working fine. My test call to normal Parse API works. But the CloudCode that connect to parse server with HTTPS is the problem. Once i changed to Hope this help. |
Hello Sent from Yahoo Mail on Android On Wed, 29 Jun, 2016 at 6:35 pm, Anusidh Pavamontrinotifications@github.com wrote:
This is how i fixed it.
It appears that the connection (HTTPS) from the client (web, mobile) to the parse server is working fine. My test call to normal Parse API works. But the CloudCode that connect to parse server with HTTPS is the problem. Once i changed to http://localhost:80/parse things just work. Hope this help. — |
Hello @apavamontri I purchased a certificate , can you please mention the required steps to install ssl certificate with parse ? Regards |
@thamer898 I didn't install SSL certificate on Parse server. I installed it on the AWS Elastic Load Balancer and Load Balancer terminates the SSL and connects to Parse server normally with HTTP port 80. To install SSL certificate you should follow the normal steps for Apache, Nginx server. But if you are using Express.js or Node.js You can follow this answer in the StackOverlow: http://stackoverflow.com/a/11805909 |
Hello @apavamontri i have already a public url with ssl certificate but i can't access the parse server via android app with https ? the android app client only work's with http ? kindly advice . Note : i used node.js & express Regards |
Hello @apavamontri Thank you very much no i can create a ssl connection between the client app and my parse server , i added this line to my index.js process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; after that i changed the url to be https in Parse.initialize and it work's , but is it encrypted now or not ? Rgards |
Closing due to lack of activity, please update to latest parse-server version and reopen if the issue persist. Don't forget to include your current:
|
I am facing the same issue. Can anyone help me? |
I'm unable to run Cloud Code functions now that I've secured Parse with SSL. I wasn't having any issues before this change and everything else (aside from LiveQuery) is working perfectly.
Calling a Cloud Code function simply times out after an extended delay of about 30sec-1min and returns an error in the browser telling me the network connection was lost.
I'm running an Express app with https. The server itself is reachable as all other data passes through aside from cloud functions.
Any solutions?
The text was updated successfully, but these errors were encountered: