Hey guys,
I am trying to migrate my parse application over to digital ocean and followed this guide :
Everything works perfectly fine until I get to the very end Test Parse Server ( Executing Example Cloud Code ) section
I tested the cloud code for the sample cloud code that was provided in the tutorial :
Parse.Cloud.define('hello', function(req, res) {
res.success('Hi');
});
so I got a Hi back in my browser as well as in postman. Then I test the function that uses sendgrid’s service to send emails :
var sendgrid = require("sendgrid");
sendgrid.initialize("sendgridAccountSid", "sendgridAuthToken");
Parse.Cloud.define("mySendGridFunction", function(request, response) {
sendgrid.sendEmail({
to: "community@parse.com",
from: "sendgrid@parse.com",
subject: "Hello from Cloud Code!",
text: "Using Parse and SendGrid is great!"
}, {
success: function(httpResponse) { response.success("Email sent!"); },
error: function(httpResponse) { response.error("Uh oh, something went wrong"); }
});
});
now this function returns me a nginx 502 Error sometimes and sometimes it returns me with internal server error
<html>
<head>
<title>502 Bad Gateway</title>
</head>
<body bgcolor="white">
<center>
<h1>502 Bad Gateway</h1>
</center>
<hr>
<center>nginx/1.4.6 (Ubuntu)</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
I went into my droplet to view the error.log file for nginx and this is the error I get there :
2016/05/09 20:15:26 [error] 31786#0: *68 connect() failed (111: Connection refused) while connecting to upstream, client: 159.203.7.41, server: test.pacecouriers.com, request: "POST /parse/functions/mySendGridFunction HTTP/1.1", upstream: "http://127.0.0.1:1337/functions/mySendGridFunction", host: "test.pacecouriers.com"
I kept looking around and I somewhere in between got a 301 parmanently moved error too and now my calls to the hello function are also not working and return me a 502 Bad Gateway error on all the requests to my nginx that I set up for my parse app on the droplet. Can someone please help me.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.