Heroku can't run Node.js bot [duplicate] - javascript

This question already has answers here:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch when I launch the bot in heroku
(1 answer)
Heroku Discord Bot is offline
(3 answers)
Python Twitter Bot w/ Heroku Error: R10 Boot Timeout
(1 answer)
Closed 3 days ago.
I've this app online for almost 6 months. When did Heroku become paid?
I turned off the app and now turned on again, but with this error message:
2023-02-17T01:41:42.781769+00:00 heroku[web.1]: Starting process with command npm start'
2023-02-17T01:41:44.529390+00:00 app[web.1]:
2023-02-17T01:41:44.529437+00:00 app[web.1]: > laura-bot#1.0.0 start
2023-02-17T01:41:44.529437+00:00 app[web.1]: > node bot.js
2023-02-17T01:41:44.529438+00:00 app[web.1]:
2023-02-17T01:42:43.020648+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2023-02-17T01:42:43.061426+00:00 heroku[web.1]: Stopping process with SIGKILL
2023-02-17T01:42:43.203331+00:00 heroku[web.1]: Process exited with status 137
2023-02-17T01:42:43.244732+00:00 heroku[web.1]: State changed from starting to crashed
2023-02-17T01:42:45.445544+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET
path="/" host=gentle-dawn-81130.herokuapp.com request_id=c52b465e-7f2f-4d90-882a-42ee1d941a75 fwd="177.170.84.112" dyno= connect= service= status=503 bytes= protocol=https

Related

getting a 503 error when uploading to heroku with my nodejs application

I have been struggling to get my app loaded to heroku for the past couple of days. I get over one hurdle and then meet another. Now I am getting a the following error.
Failed to load resource: the server responded with a status of 503 (Service Unavailable) /favicon.ico
On the logs I am getting these error messages.
2018-04-11T08:13:48.238214+00:00 app[web.1]: > rock-paper-scissors#1.0.0 start /app
2018-04-11T08:13:48.331598+00:00 app[web.1]: Server has started.
2018-04-11T08:13:48.238216+00:00 app[web.1]:
2018-04-11T08:13:48.238198+00:00 app[web.1]:
2018-04-11T08:14:46.646952+00:00 heroku[web.1]: State changed from starting to crashed
2018-04-11T08:14:46.571274+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2018-04-11T08:14:46.629369+00:00 heroku[web.1]: Process exited with status 137
2018-04-11T09:38:48.218885+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=brianpat-rock-paper-scissors.herokuapp.com request_id=0db40b3c-c918-4a3d-9a4d-f3a5fcf69bc8 fwd="94.174.32.117" dyno= connect= service= status=503 bytes= protocol=https
2018-04-11T09:38:48.541351+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=brianpat-rock-paper-scissors.herokuapp.com request_id=ecf56ae7-84e6-43a0-9a77-3e9f9a7f538f fwd="94.174.32.117" dyno= connect= service= status=503 bytes= protocol=https
Yesterday I was getting a Method not Allowed error and now I am not sure if it has moved on or not. Not sure if this is my end or whether this is a maintenance issue with heroku? Possibly my end. I have tried looking for the same error on Stackoverflow but they have not proved helpful. Any help would be appreciated.

Heroko application error with node js

First time using Heroko. Followed the steps and my build was successful but when I go to the URL I got an application error. I looked in the logs but I'm not really sure whats happening, below is the list of logs I had
2016-08-04T14:24:15.352519+00:00 heroku[web.1]: State changed from crashed to starting
2016-08-04T14:24:31.776384+00:00 heroku[web.1]: Starting process with command `node server.js`
2016-08-04T14:24:34.211793+00:00 app[web.1]: keyword api listening at http://[::]:8088
2016-08-04T14:25:32.328147+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-08-04T14:25:32.327930+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-08-04T14:25:32.501167+00:00 heroku[web.1]: State changed from starting to crashed
2016-08-04T14:25:32.503024+00:00 heroku[web.1]: State changed from crashed to starting
2016-08-04T14:25:32.477573+00:00 heroku[web.1]: Process exited with status 137
2016-08-04T14:25:36.445941+00:00 heroku[web.1]: Starting process with command `node server.js`
2016-08-04T14:25:39.335482+00:00 app[web.1]: keyword api listening at http://[::]:8088
2016-08-04T14:26:37.186681+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-08-04T14:26:37.186681+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-08-04T14:26:37.329330+00:00 heroku[web.1]: Process exited with status 137
2016-08-04T14:26:37.353704+00:00 heroku[web.1]: State changed from starting to crashed
2016-08-04T14:26:37.619772+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=shielded-temple-17247.herokuapp.com request_id=db8eb419-e950-4768-8a3f-319a84f7d4e2 fwd="2.125.30.1" dyno= connect= service= status=503 bytes=
2016-08-04T14:26:38.809203+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=shielded-temple-17247.herokuapp.com request_id=5661b532-80af-40cb-8ae3-0bf9868b5e0f fwd="2.125.30.1" dyno= connect= service= status=503 bytes=
What do you have defined in your Procfile? Right now, it appears to be something like this:
web: node server.js
The Procfile tells Heroku how to run your application. The logs you showed indicate that you are trying to run your Node server on port 8088 -- this is likely the issue.
Heroku doesn't allow you to run your server on ANY port you want -- instead, it will dynamically tell you what port to run your server on when your application starts. It does this through the usage of an environment variable named PORT.
What you need to do is modify your server.js code so that you start your server on process.env.PORT.
Here's an example (in express.js):
var express = require('express');
var app = express();
app.listen(process.env.PORT);
That will successfully start up a Node server on Heroku by automatically binding to the correct port.
Hope that helps!

Heroku app not working on remote

I am deploying a simple node.js application. It seems to run fine locally (I see all the functionality I have written so far), but when I run:
heroku open cool
I just see a blank page.
Here are my logs:
2016-03-28T19:03:04.567334+00:00 heroku[web.1]: Idling
2016-03-28T19:03:04.568049+00:00 heroku[web.1]: State changed from up to down
2016-03-28T19:03:09.551701+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-03-28T19:03:11.228745+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2016-03-28T19:03:12.390081+00:00 heroku[web.1]: Process exited with status 22
2016-03-28T21:08:49.503946+00:00 heroku[web.1]: Unidling
2016-03-28T21:08:49.504269+00:00 heroku[web.1]: State changed from down to starting
2016-03-28T21:08:51.391775+00:00 heroku[web.1]: Starting process with command `npm start`
2016-03-28T21:08:56.437135+00:00 app[web.1]:
2016-03-28T21:08:56.437149+00:00 app[web.1]: > transloc#1.0.0 start /app
2016-03-28T21:08:56.437150+00:00 app[web.1]: > node server.js
2016-03-28T21:08:56.437151+00:00 app[web.1]:
2016-03-28T21:08:57.152952+00:00 heroku[web.1]: State changed from starting to up
2016-03-28T21:08:58.586930+00:00 heroku[router]: at=info method=GET path="/cool" host=still-depths-35391.herokuapp.com request_id=6feab52c-143c-4353-bbbc-696355042cbc fwd="152.3.43.142" dyno=web.1 connect=1ms service=25ms status=200 bytes=1764
2016-03-28T21:08:58.910098+00:00 heroku[router]: at=info method=GET path="/server.js" host=still-depths-35391.herokuapp.com request_id=5c3ab4d4-0a5d-48fa-b272-7c82000da3dd fwd="152.3.43.142" dyno=web.1 connect=1ms service=7ms status=200 bytes=1764
2016-03-28T21:08:58.960943+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=still-depths-35391.herokuapp.com request_id=e7a35c05-da23-4a47-995e-98f015ea08ed fwd="152.3.43.142" dyno=web.1 connect=5ms service=7ms status=200 bytes=1764

what does error status 413 in node.js, heroku mean?

I have a node.js app that works fine locally but when i run in at heroku it quits, I status 0 or status 143 does anyone understand what this can mean?
2015-04-14T21:14:41.428508+00:00 heroku[api]: Release v8 created by
josef#actionist.se
2015-04-14T21:14:41.569626+00:00 heroku[web.1]: State changed from up to starting
2015-04-14T21:14:44.101446+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-04-14T21:14:45.789499+00:00 heroku[web.1]: Starting process with command `node index.js`
2015-04-14T21:14:45.675609+00:00 heroku[web.1]: Process exited with status 143
2015-04-14T21:14:47.559184+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
2015-04-14T21:14:47.559208+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
2015-04-14T21:14:49.398042+00:00 app[web.1]: Node app is running at localhost:26268
2015-04-14T21:14:49.825551+00:00 heroku[web.1]: State changed from starting to up
2015-04-14T21:16:05.765151+00:00 heroku[api]: Deploy bcb1918 by josef#actionist.se
2015-04-14T21:16:05.765151+00:00 heroku[api]: Release v9 created by josef#actionist.se
2015-04-14T21:16:06.234464+00:00 heroku[web.1]: State changed from up to starting
2015-04-14T21:16:09.804498+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-04-14T21:16:10.788591+00:00 heroku[web.1]: Starting process with command `npm start`
2015-04-14T21:16:11.515039+00:00 heroku[web.1]: Process exited with status 143
2015-04-14T21:16:12.732654+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
2015-04-14T21:16:12.732736+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
2015-04-14T21:16:13.951425+00:00 app[web.1]:
2015-04-14T21:16:13.951416+00:00 app[web.1]:
2015-04-14T21:16:13.951422+00:00 app[web.1]: > party#0.1.3 start /app
2015-04-14T21:16:13.951424+00:00 app[web.1]: > node app.js
2015-04-14T21:16:15.479452+00:00 heroku[web.1]: Process exited with status 0
2015-04-14T21:16:15.494024+00:00 heroku[web.1]: State changed from starting to crashed
2015-04-14T21:17:13.883207+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/host=actionistcookalong.herokuapp.com request_id=a5f2ce21-21bd-43ac-8434-9eb39282c542 fwd="178.78.232.172" dyno= connect= service= status=503 bytes=
2015-04-14T21:21:01.044982+00:00 heroku[web.1]: State changed from crashed to starting
2015-04-14T21:21:05.040510+00:00 heroku[web.1]: Starting process with command `npm start`
2015-04-14T21:21:06.954809+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
2015-04-14T21:21:06.954834+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
2015-04-14T21:21:07.605924+00:00 app[web.1]:
2015-04-14T21:21:07.605931+00:00 app[web.1]: > party#0.1.3 start /app
2015-04-14T21:21:07.605933+00:00 app[web.1]: > node app.js
2015-04-14T21:21:07.605935+00:00 app[web.1]:
2015-04-14T21:21:08.874268+00:00 heroku[web.1]: State changed from starting to crashed
2015-04-14T21:21:08.868440+00:00 heroku[web.1]: Process exited with status 0
An exit code of 143 means that a kill process was sent and a SIGTERM signal terminated your process. This is usually triggered whenever you execute any restart commands.
Try running the console, it might crash as well... but will give you the reasoning. Usually it will be some small change you hadn't noticed or forgotten about that the Heroku error logs are bad at reporting.
run this
heroku run node
or
heroku restart

How to connect to a mongodb database on Heroku using mongoose?

Currently my app works fine locally and can connect to my local database.
Right now this is the error I am getting when i try and run it on heroku:
2014-04-17T06:32:23.404458+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T06:32:23.404460+00:00 app[web.1]: > node app.js
2014-04-17T06:32:24.052231+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T06:32:24.090050+00:00 app[web.1]: Database connection error, fcukkk: [Error: failed to connect to [localhost:27017]]
2014-04-17T06:32:24.084553+00:00 app[web.1]: Express server listening on port 23569
2014-04-17T06:32:24.630834+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T06:33:08.084028+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=9bf3db67-e00e-428a-896c-26c03dfa01ff fwd="68.99.126.105" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0
2014-04-17T06:33:08.094792+00:00 app[web.1]: GET / 200 29995ms
2014-04-17T06:33:08.624842+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=pure-cliffs-4076.herokuapp.com request_id=d09fe61e-f608-47fd-9b1f-a5b4ea54a2a9 fwd="68.99.126.105" dyno=web.1 connect=1ms service=8ms status=404 bytes=193
2014-04-17T06:33:08.620901+00:00 app[web.1]: GET /favicon.ico 404 5ms
2014-04-17T06:33:44.013253+00:00 heroku[web.1]: State changed from up to starting
2014-04-17T06:33:43.925737+00:00 heroku[api]: Add mongolab:sandbox add-on by marshall.a.x#gmail.com
2014-04-17T06:33:43.925801+00:00 heroku[api]: Release v4 created by marshall.a.x#gmail.com
2014-04-17T06:33:47.537662+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-04-17T06:33:48.704235+00:00 he
roku[web.1]: Starting process with command `npm start`
2014-04-17T06:33:49.868707+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T06:33:49.868699+00:00 app[web.1]:
2014-04-17T06:33:49.868711+00:00 app[web.1]:
2014-04-17T06:33:49.868709+00:00 app[web.1]: > node app.js
2014-04-17T06:33:50.254949+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T06:33:50.274924+00:00 app[web.1]: Database connection error, fcukkk: [Error: failed to connect to [localhost:27017]]
2014-04-17T06:33:50.271844+00:00 app[web.1]: Express server listening on port 21153
2014-04-17T06:33:49.631038+00:00 heroku[web.1]: Process exited with status 143
2014-04-17T06:33:50.361358+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T07:38:52.772530+00:00 heroku[web.1]: Idling
2014-04-17T07:38:52.773249+00:00 heroku[web.1]: State changed from up to down
2014-04-17T07:38:56.398500+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-04-17T07:38:59.466635+00:00 heroku[web.1]: Process exited with status 143
2014-04-17T18:18:34.665450+00:00 heroku[web.1]: Unidling
2014-04-17T18:18:34.665450+00:00 heroku[web.1]: State changed from down to starting
2014-04-17T18:18:39.773345+00:00 heroku[web.1]: Starting process with command `npm start`
2014-04-17T18:18:41.209327+00:00 app[web.1]:
2014-04-17T18:18:41.209334+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T18:18:41.209336+00:00 app[web.1]: > node app.js
2014-04-17T18:18:41.209466+00:00 app[web.1]:
2014-04-17T18:18:41.831107+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T18:18:41.863975+00:00 app[web.1]: Database connection error, fcukkk: [Error: failed to connect to [localhost:27017]]
2014-04-17T18:18:41.859394+00:00 app[web.1]: Express server listening on port 56521
2014-04-17T18:18:41.983113+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T18:19:12.750685+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=b7e7cab0-e79f-4457-9e5d-1acbfd494ef0 fwd="68.99.126.105" dyno=web.1 connect=5ms service=30001ms status=503 bytes=0
2014-04-17T18:19:12.754834+00:00 app[web.1]: GET / 200 29995ms
2014-04-17T19:21:21.596778+00:00 heroku[web.1]: Idling
2014-04-17T19:21:21.597514+00:00 heroku[web.1]: State changed from up to down
2014-04-17T19:21:26.046285+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-04-17T19:21:28.181093+00:00 heroku[web.1]: Process exited with status 143
2014-04-17T20:56:21.949618+00:00 heroku[web.1]: Unidling
2014-04-17T20:56:21.949987+00:00 heroku[web.1]: State changed from down to starting
2014-04-17T20:56:31.657944+00:00 heroku[web.1]: Starting process with command `npm start`
2014-04-17T20:56:33.655866+00:00 app[web.1]:
2014-04-17T20:56:33.655871+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T20:56:33.655873+00:00 app[web.1]: > node app.js
2014-04-17T20:56:33.655875+00:00 app[web.1]:
2014-04-17T20:56:34.682567+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T20:56:34.706650+00:00 app[web.1]: Database connection error, fcukkk: [Error: failed to connect to [localhost:27017]]
2014-04-17T20:56:34.703013+00:00 app[web.1]: Express server listening on port 21923
2014-04-17T20:56:35.308394+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T20:57:08.004131+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=033a5a44-68a3-4b1c-8f6c-5755371d076d fwd="68.99.126.105" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0
2014-04-17T20:57:08.005107+00:00 app[web.1]: GET / 200 29992ms
2014-04-17T21:17:36.623084+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=1117b0b1-da9d-4fef-ad79-f1a5c4178807 fwd="68.99.126.105" dyno=web.1 connect=2ms service=30000ms status=503 bytes=0
2014-04-17T21:17:36.625513+00:00 app[web.1]: GET / 200 30000ms
2014-04-17T22:07:00.807923+00:00 heroku[web.1]: Idling
2014-04-17T22:07:00.809134+00:00 heroku[web.1]: State changed from up to down
2014-04-17T22:07:04.732639+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-04-17T22:07:07.514765+00:00 heroku[web.1]: Process exited with status 143
2014-04-17T22:32:27+00:00 heroku[slug-compiler]: Slug compilation started
2014-04-17T22:33:00+00:00 heroku[slug-compiler]: Slug compilation finished
2014-04-17T22:33:00.065665+00:00 heroku[web.1]: State changed from down to starting
2014-04-17T22:32:59.921981+00:00 heroku[api]: Deploy 0e3a24a by marshall.a.x#gmail.com
2014-04-17T22:32:59.922073+00:00 heroku[api]: Release v5 created by marshall.a.x#gmail.com
2014-04-17T22:33:05.771395+00:00 heroku[web.1]: Starting process with command `npm start`
2014-04-17T22:33:07.654364+00:00 app[web.1]: > application-name#0.0.1 start /app
2014-04-17T22:33:07.654367+00:00 app[web.1]:
2014-04-17T22:33:07.654366+00:00 app[web.1]: > node app.js
2014-04-17T22:33:07.654359+00:00 app[web.1]:
2014-04-17T22:33:08.435746+00:00 app[web.1]: /public/images/test_image.jpg
2014-04-17T22:33:08.474993+00:00 app[web.1]: Express server listening on port 20321
2014-04-17T22:33:08.771030+00:00 app[web.1]: sup stud, Database connected.
2014-04-17T22:33:08.770901+00:00 app[web.1]: Succeeded connected to: mongodb://mongodb://heroku_app24230415:l91npmc6qlrdole3ptlq0s8not#ds045157.mongolab.com:45157/heroku_app24230415/images
2014-04-17T22:33:08.577315+00:00 heroku[web.1]: State changed from starting to up
2014-04-17T22:33:48.606992+00:00 app[web.1]: []
2014-04-17T22:33:49.143625+00:00 heroku[router]: at=info method=GET path=/ host=pure-cliffs-4076.herokuapp.com request_id=982dd016-e68c-4190-a41e-c3a6780a06ef fwd="68.99.126.105" dyno=web.1 connect=2ms service=624ms status=500 bytes=7683
2014-04-17T22:33:49.176065+00:00 app[web.1]: 13| form(method="POST" action="/view/#{image._id}" enctype="multipart/form-data")
2014-04-17T22:33:49.176067+00:00 app[web.1]: 14| input(type="image" src="/images/#{image.source}" name="bigImage" width="300")
2014-04-17T22:33:49.176068+00:00 app[web.1]:
2014-04-17T22:33:49.176060+00:00 app[web.1]: 10| li
2014-04-17T22:33:49.176070+00:00 app[web.1]: Cannot read property 'source' of undefined
2014-04-17T22:33:49.176050+00:00 app[web.1]: TypeError: /app/views/index.jade:11
2014-04-17T22:33:49.176063+00:00 app[web.1]: 12| span
2014-04-17T22:33:49.176062+00:00 app[web.1]: > 11| img(src="/images/#{image.source}" name="original")
2014-04-17T22:33:49.176058+00:00 app[web.1]: 9| each image in images
2014-04-17T22:33:49.176078+00:00 app[web.1]: at res (/app/node_modules/jade/lib/jade.js:173:38)
2014-04-17T22:33:49.176071+00:00 app[web.1]: at eval (eval at <anonymous> (/app/node_modules/jade/lib/jade.js:172:8), <anonymous>:78:56)
2014-04-17T22:33:49.176073+00:00 app[web.1]: at eval (eval at <anonymous> (/app/node_modules/jade/lib/jade.js:172:8), <anonymous>:165:4)
2014-04-17T22:33:49.176075+00:00 app[web.1]: at eval (eval at <anonymous> (/app/node_modules/jade/lib/jade.js:172:8), <anonymous>:184:21)
2014-04-17T22:33:49.176079+00:00 app[web.1]: at Object.exports.render (/app/node_modules/jade/lib/jade.js:269:10)
2014-04-17T22:33:49.176084+00:00 app[web.1]: at View.render (/app/node_modules/express/lib/view.js:76:8)
2014-04-17T22:33:49.176081+00:00 app[web.1]: at Object.exports.renderFile (/app/node_modules/jade/lib/jade.js:305:18)
2014-04-17T22:33:49.176082+00:00 app[web.1]: at View.exports.renderFile [as engine] (/app/node_modules/jade/lib/jade.js:290:21)
2014-04-17T22:33:49.176087+00:00 app[web.1]: at ServerResponse.res.render (/app/node_modules/express/lib/response.js:798:7)
2014-04-17T22:33:49.176085+00:00 app[web.1]: at Function.app.render (/app/node_modules/express/lib/application.js:504:10)
2014-04-17T22:33:49.181859+00:00 app[web.1]: GET / 500 607ms
This is the relevant part of my app.js file:
var uristring= 'mongodb://'+process.env.MONGOLAB_URI+'/images';
var theport = process.env.PORT || 5000;
var appDir = path.dirname(require.main.filename);
mongoose.connect(uristring, function(err,res){
if (err) {
console.log('ERROR connecting to: '+uristring+'. ' + err)
}
else {
console.log('Succeeded connected to: '+uristring);
}
});
var conn = mongoose.connection;
conn.on('error', console.error.bind(console, 'Database connection error, fcukkk:'));
conn.once('open', function callback() {console.log("sup stud, Database connected.")});
I am confused because there is no mention in the docs https://devcenter.heroku.com/articles/nodejs-mongoose of actually creating the database that I am trying to connect to. I assume this is something that mongoose does when you initially connect to the db.
Do you realize that you are connecting successfully at the end of the log? The first 3 times it looked for your DB at localhost:27017, but the 4th time it looked for the proper address (it seems).

Categories

Resources