Friday 22 February 2019

AWS Elastic Beanstalk deploy question

I'm hoping someone can help out before I've torn all of my hair out.​I built a really basic set of endpoints in Node JS using Express. All is running perfectly from my local dev environment. Deployed to AWS on Elastic Beanstalk, and the service posts successful responses from Postman, and the GET endpoints return data just fine if I just put the URL in the browser. The problem is, AJAX requests from simple front-end code on a Shopify site not only time out, but the Node console logs I have set on the endpoints don't even register that the AJAX request arrived. Tested the front-end code with endpoints on a non-AWS service that I know works and they return correctly. My console logs register correctly when I hit the endpoints with Postman. Doublechecked URLs, etc.​For CORS stuff I have:app.use(function(req, res, next) {res.header("Access-Control-Allow-Origin", "site");res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");next();});Is there some AWS setup thing I might be missing, maybe around inbound traffic, to have client-side AJAX requests be accepted as inbound traffic and respond successfully that I just don't know about?​My inbound rules currently are port 80: 0.0.0.0/0And 443 same thing, but this install doesn't have an SSL certificate, so I'm not sure that matters. Outbound is wide open.​AJAX request is just this in case I missed something AWS-centric that needs to be here?$.ajax({url: url,type: 'POST',async: true,crossDomain: true,contentType: 'application/json',data: JSON.stringify(data),success: function(res){console.log('response-received');console.log(res);},error: function(res){console.log('error');console.log(res);}});​It's a Friday, so am I just missing something really simple here? I've been at this for tooo many hours. Any help greatly appreciated. Thanks!

Submitted February 22, 2019 at 08:15PM by bohr314

No comments:

Post a Comment