0

I've been trying to get the https://github.com/scotch-io/node-todo app working on a running Bitnami MEAN Stack on AWS by following this guide https://scotch.io/tutorials/deploying-a-mean-app-to-amazon-ec2-part-1

When running locally, the app seems to work without any major issues (while connecting to the default DB that is configured in the databases.js file of node-todo), the web interface runs smooth and I can add and remove entries into the todo app.

But when I run the app on the server, either if I try to use it towards the local MongoDB or even when the app is trying to write to the preconfigured DB in the aforementioned database.js file it only takes about 5 seconds before the app crashes with the following output (from the terminal window where the server.js file is executed):

bitnami@ip-172-XX-X-XXX:~/apps/node-todo$ sudo node server.js 
App listening on port 8080
_http_outgoing.js:346
    throw new Error('Can\'t set headers after they are sent.');
    ^

Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:346:11)
at ServerResponse.header (/opt/bitnami/apps/node-todo/node_modules/express/lib/response.js:718:10)
at ServerResponse.json (/opt/bitnami/apps/node-todo/node_modules/express/lib/response.js:246:10)
at /opt/bitnami/apps/node-todo/app/routes.js:11:13
at /opt/bitnami/apps/node-todo/node_modules/kareem/index.js:160:11
at Immediate.cb (/opt/bitnami/apps/node-todo/node_modules/mongoose/lib/query.js:1032:14)
at Immediate._onImmediate (/opt/bitnami/apps/node-todo/node_modules/mquery/lib/utils.js:137:16)
at tryOnImmediate (timers.js:543:15)
at processImmediate [as _immediateCallback] (timers.js:523:5)

Now, this is my first go at a node.js app, and the Bitnami MEAN stack for that matter so I don't have a lot to go on when it comes to troubleshooting on my own here.

I do, however know, that I can connect to the MongoDB on the server without any issues, I have also allowed for inbound connections to TCP port 27017 from all IP's and I have allowed for all outbound connections as well so there should not be any sort of connectivity issues here.

Also, the web app is running for a few seconds each time before it crashes, but it is unable to display the todo list which is what it should be fetching from the MongoDB.

lundzern
  • 417
  • 3
  • 11

0 Answers0