I can not deploy my nodejs based app to Heroku - javascript

I have created an app that upload some files and than send me object like that
{"name":"MEHMET SAYIN CV - 10_2021.pdf","type":"application/pdf","size":99771}
I used multer to handle uploading files. When I upload it to heroku I failed.I want to share the logs related.
2021-10-15T15:51:02.457409+00:00 app[api]: Deploy 6e984f86 by user sayinmehmet47#gmail.com
2021-10-15T15:51:02.457409+00:00 app[api]: Release v11 created by user sayinmehmet47#gmail.com
2021-10-15T15:51:03.599539+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-15T15:51:05.000000+00:00 app[api]: Build succeeded
2021-10-15T15:51:05.698098+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-15T15:51:06.737506+00:00 app[web.1]:
2021-10-15T15:51:06.737526+00:00 app[web.1]: > file_metadata#0.0.1 start /app
2021-10-15T15:51:06.737527+00:00 app[web.1]: > node server.js
2021-10-15T15:51:06.737527+00:00 app[web.1]:
2021-10-15T15:51:07.036041+00:00 app[web.1]: connected
2021-10-15T15:51:07.068246+00:00 app[web.1]: /app/node_modules/mkdirp/index.js:91
2021-10-15T15:51:07.068247+00:00 app[web.1]: throw err0;
2021-10-15T15:51:07.068248+00:00 app[web.1]: ^
2021-10-15T15:51:07.068248+00:00 app[web.1]:
2021-10-15T15:51:07.068248+00:00 app[web.1]: Error: EROFS: read-only file system, mkdir '/public'
2021-10-15T15:51:07.068249+00:00 app[web.1]: at Object.mkdirSync (fs.js:1013:3)
2021-10-15T15:51:07.068249+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:72:13)
2021-10-15T15:51:07.068250+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T15:51:07.068250+00:00 app[web.1]: at Function.sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T15:51:07.068250+00:00 app[web.1]: at new DiskStorage (/app/node_modules/multer/storage/disk.js:21:12)
2021-10-15T15:51:07.068251+00:00 app[web.1]: at module.exports (/app/node_modules/multer/storage/disk.js:65:10)
2021-10-15T15:51:07.068251+00:00 app[web.1]: at new Multer (/app/node_modules/multer/index.js:15:20)
2021-10-15T15:51:07.068252+00:00 app[web.1]: at multer (/app/node_modules/multer/index.js:95:12)
2021-10-15T15:51:07.068252+00:00 app[web.1]: at Object.<anonymous> (/app/api/files.js:4:16)
2021-10-15T15:51:07.068252+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14) {
2021-10-15T15:51:07.068253+00:00 app[web.1]: errno: -30,
2021-10-15T15:51:07.068253+00:00 app[web.1]: syscall: 'mkdir',
2021-10-15T15:51:07.068253+00:00 app[web.1]: code: 'EROFS',
2021-10-15T15:51:07.068254+00:00 app[web.1]: path: '/public'
2021-10-15T15:51:07.068254+00:00 app[web.1]: }
2021-10-15T15:51:07.079497+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-10-15T15:51:07.079732+00:00 app[web.1]: npm ERR! errno 1
2021-10-15T15:51:07.083831+00:00 app[web.1]: npm ERR! file_metadata#0.0.1 start: `node server.js`
2021-10-15T15:51:07.083871+00:00 app[web.1]: npm ERR! Exit status 1
2021-10-15T15:51:07.083924+00:00 app[web.1]: npm ERR!
2021-10-15T15:51:07.083988+00:00 app[web.1]: npm ERR! Failed at the file_metadata#0.0.1 start script.
2021-10-15T15:51:07.083989+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-15T15:51:07.089384+00:00 app[web.1]:
2021-10-15T15:51:07.089446+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-15T15:51:07.089472+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-10-15T15_51_07_084Z-debug.log
2021-10-15T15:51:07.196350+00:00 heroku[web.1]: Process exited with status 1
2021-10-15T15:51:07.347289+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-15T15:51:12.784398+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=filedownl12.herokuapp.com request_id=fe098106-1546-4b7c-9b8c-fefe790dfae7 fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T15:51:13.747221+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=filedownl12.herokuapp.com request_id=8173d073-97c1-45e1-afab-c3b2da397e12 fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T16:04:45.000000+00:00 app[api]: Build started by user sayinmehmet47#gmail.com
2021-10-15T16:05:21.465576+00:00 app[api]: Deploy 1f51e389 by user sayinmehmet47#gmail.com
2021-10-15T16:05:21.465576+00:00 app[api]: Release v12 created by user sayinmehmet47#gmail.com
2021-10-15T16:05:23.278268+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-15T16:05:24.000000+00:00 app[api]: Build succeeded
2021-10-15T16:05:26.141343+00:00 heroku[web.1]: Starting process with command `node ./server.js`
2021-10-15T16:05:27.754473+00:00 app[web.1]: connected
2021-10-15T16:05:27.819924+00:00 app[web.1]: /app/node_modules/mkdirp/index.js:91
2021-10-15T16:05:27.819926+00:00 app[web.1]: throw err0;
2021-10-15T16:05:27.819926+00:00 app[web.1]: ^
2021-10-15T16:05:27.819927+00:00 app[web.1]:
2021-10-15T16:05:27.819927+00:00 app[web.1]: Error: EROFS: read-only file system, mkdir '/public'
2021-10-15T16:05:27.819928+00:00 app[web.1]: at Object.mkdirSync (fs.js:1013:3)
2021-10-15T16:05:27.819928+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:72:13)
2021-10-15T16:05:27.819928+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T16:05:27.819929+00:00 app[web.1]: at Function.sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T16:05:27.819929+00:00 app[web.1]: at new DiskStorage (/app/node_modules/multer/storage/disk.js:21:12)
2021-10-15T16:05:27.819930+00:00 app[web.1]: at module.exports (/app/node_modules/multer/storage/disk.js:65:10)
2021-10-15T16:05:27.819930+00:00 app[web.1]: at new Multer (/app/node_modules/multer/index.js:15:20)
2021-10-15T16:05:27.819931+00:00 app[web.1]: at multer (/app/node_modules/multer/index.js:95:12)
2021-10-15T16:05:27.819931+00:00 app[web.1]: at Object.<anonymous> (/app/api/files.js:4:16)
2021-10-15T16:05:27.819931+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14) {
2021-10-15T16:05:27.819932+00:00 app[web.1]: errno: -30,
2021-10-15T16:05:27.819932+00:00 app[web.1]: syscall: 'mkdir',
2021-10-15T16:05:27.819932+00:00 app[web.1]: code: 'EROFS',
2021-10-15T16:05:27.819933+00:00 app[web.1]: path: '/public'
2021-10-15T16:05:27.819933+00:00 app[web.1]: }
2021-10-15T16:05:27.968565+00:00 heroku[web.1]: Process exited with status 1
2021-10-15T16:05:28.098649+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-15T16:05:28.136896+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-15T16:05:30.375434+00:00 heroku[web.1]: Starting process with command `node ./server.js`
2021-10-15T16:05:32.063799+00:00 app[web.1]: connected
2021-10-15T16:05:32.108031+00:00 app[web.1]: /app/node_modules/mkdirp/index.js:91
2021-10-15T16:05:32.108033+00:00 app[web.1]: throw err0;
2021-10-15T16:05:32.108033+00:00 app[web.1]: ^
2021-10-15T16:05:32.108033+00:00 app[web.1]:
2021-10-15T16:05:32.108034+00:00 app[web.1]: Error: EROFS: read-only file system, mkdir '/public'
2021-10-15T16:05:32.108034+00:00 app[web.1]: at Object.mkdirSync (fs.js:1013:3)
2021-10-15T16:05:32.108035+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:72:13)
2021-10-15T16:05:32.108035+00:00 app[web.1]: at sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T16:05:32.108035+00:00 app[web.1]: at Function.sync (/app/node_modules/mkdirp/index.js:78:24)
2021-10-15T16:05:32.108036+00:00 app[web.1]: at new DiskStorage (/app/node_modules/multer/storage/disk.js:21:12)
2021-10-15T16:05:32.108036+00:00 app[web.1]: at module.exports (/app/node_modules/multer/storage/disk.js:65:10)
2021-10-15T16:05:32.108036+00:00 app[web.1]: at new Multer (/app/node_modules/multer/index.js:15:20)
2021-10-15T16:05:32.108037+00:00 app[web.1]: at multer (/app/node_modules/multer/index.js:95:12)
2021-10-15T16:05:32.108037+00:00 app[web.1]: at Object.<anonymous> (/app/api/files.js:4:16)
2021-10-15T16:05:32.108037+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14) {
2021-10-15T16:05:32.108038+00:00 app[web.1]: errno: -30,
2021-10-15T16:05:32.108041+00:00 app[web.1]: syscall: 'mkdir',
2021-10-15T16:05:32.108041+00:00 app[web.1]: code: 'EROFS',
2021-10-15T16:05:32.108041+00:00 app[web.1]: path: '/public'
2021-10-15T16:05:32.108041+00:00 app[web.1]: }
2021-10-15T16:05:32.267952+00:00 heroku[web.1]: Process exited with status 1
2021-10-15T16:05:32.695933+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-15T16:05:33.707024+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=filedownl12.herokuapp.com request_id=c9fdfd08-1b36-450e-a4de-fb65785677a4 fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T16:05:34.925481+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=filedownl12.herokuapp.com request_id=3aca34c2-47e0-4f99-9884-13b91ed25f99 fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T16:13:09.486503+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=filedownl12.herokuapp.com request_id=e41ba396-2172-4804-a573-0fafc1a2c47b fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
2021-10-15T16:13:10.694600+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=filedownl12.herokuapp.com request_id=4ef46b32-012c-43b2-8342-0a0637d5a29b fwd="77.49.34.161" dyno= connect= service= status=503 bytes= protocol=https
I also tried to be sure if I set the variables for MONGO_URI,I also set them. Also I created a procfile and write inside it
web: node ./server.js
But it didnt works. I lastly want to share my directories picture.

Related

Trouble Deploying a Website/Web App on Heroku

I am trying to deploy a web app on Heroku and it keeps crashing.
After checking the logs, it says it crashed right before starting process with command 'node app.js'
After pushing my app to Heroku Git, I clicked on the link and it gave me a missing script: start.
I added "start": "index.js" to my scripts, replacing the test and return 1 string.
Now, I'm getting a different application error.
Here are the logs:
2019-04-16T15:55:19.291517+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-04-16T15_55_19_283Z-debug.log
2019-04-16T15:55:22.076257+00:00 heroku[web.1]: Starting process with command `npm start`
2019-04-16T15:55:24.008573+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T15:55:24.034855+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T15:55:23.952515+00:00 app[web.1]: npm ERR! missing script: start
2019-04-16T15:55:23.958426+00:00 app[web.1]:
2019-04-16T15:55:23.958664+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-04-16T15:55:23.958754+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-04-16T15_55_23_953Z-debug.log
2019-04-16T16:19:04.974643+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T16:19:08.471350+00:00 heroku[web.1]: Starting process with command `npm start`
2019-04-16T16:19:10.946953+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T16:19:10.920954+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T16:19:10.847576+00:00 app[web.1]: npm ERR! missing script: start
2019-04-16T16:19:10.856940+00:00 app[web.1]:
2019-04-16T16:19:10.862276+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-04-16T16:19:10.862279+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-04-16T16_19_10_849Z-debug.log
2019-04-16T16:21:52.000000+00:00 app[api]: Build started by user bsautry#ualr.edu
2019-04-16T16:22:14.048093+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T16:22:13.644927+00:00 app[api]: Release v4 created by user bsautry#ualr.edu
2019-04-16T16:22:13.644927+00:00 app[api]: Deploy 69b62110 by user bsautry#ualr.edu
2019-04-16T16:22:17.615771+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T16:22:18.000000+00:00 app[api]: Build succeeded
2019-04-16T16:22:20.049173+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T16:22:20.067122+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T16:22:19.975525+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T16:22:19.975544+00:00 app[web.1]: throw err;
2019-04-16T16:22:19.975546+00:00 app[web.1]: ^
2019-04-16T16:22:19.975548+00:00 app[web.1]:
2019-04-16T16:22:19.975549+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T16:22:19.975551+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T16:22:19.975553+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T16:22:19.975555+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T16:22:19.975557+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T16:22:19.975559+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T16:25:54.162474+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=loveplumbing.herokuapp.com request_id=589c1650-a614-4aae-a8e5-ffb58a523e1e fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T16:25:54.759301+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=loveplumbing.herokuapp.com request_id=3c7f8d06-e415-48ae-952d-3968d12db75c fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T16:30:55.410784+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T16:30:58.687945+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T16:31:01.064389+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T16:31:00.983841+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T16:31:00.983863+00:00 app[web.1]: throw err;
2019-04-16T16:31:00.983865+00:00 app[web.1]: ^
2019-04-16T16:31:00.983866+00:00 app[web.1]:
2019-04-16T16:31:00.983868+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T16:31:00.983870+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T16:31:00.983872+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T16:31:00.983873+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T16:31:00.983874+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T16:31:00.983875+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T16:31:01.040784+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T16:59:14.705641+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T16:59:18.023601+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T16:59:20.925080+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T16:59:20.905853+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T16:59:20.804107+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T16:59:20.804145+00:00 app[web.1]: throw err;
2019-04-16T16:59:20.804147+00:00 app[web.1]: ^
2019-04-16T16:59:20.804149+00:00 app[web.1]:
2019-04-16T16:59:20.804150+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T16:59:20.804153+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T16:59:20.804155+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T16:59:20.804156+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T16:59:20.804158+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T16:59:20.804159+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T17:37:18.987655+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=loveplumbing.herokuapp.com request_id=1fc71b49-e1f4-4e23-b898-9d77035b5e04 fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:37:19.514237+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=loveplumbing.herokuapp.com request_id=a9886709-5ec0-49da-adfd-0c02d8378903 fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:45:46.000000+00:00 app[api]: Build started by user bsautry#ualr.edu
2019-04-16T17:46:08.863208+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T17:46:08.459037+00:00 app[api]: Release v5 created by user bsautry#ualr.edu
2019-04-16T17:46:08.459037+00:00 app[api]: Deploy 9cfd1de3 by user bsautry#ualr.edu
2019-04-16T17:46:12.241604+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T17:46:13.000000+00:00 app[api]: Build succeeded
2019-04-16T17:46:14.898819+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T17:46:14.914929+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-16T17:46:14.882816+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T17:46:14.816039+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T17:46:14.816072+00:00 app[web.1]: throw err;
2019-04-16T17:46:14.816074+00:00 app[web.1]: ^
2019-04-16T17:46:14.816076+00:00 app[web.1]:
2019-04-16T17:46:14.816078+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T17:46:14.816080+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T17:46:14.816081+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T17:46:14.816083+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T17:46:14.816084+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T17:46:14.816086+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T17:46:19.195129+00:00 heroku[web.1]: Starting process with command `node app.js`
2019-04-16T17:46:22.064061+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-16T17:46:22.040652+00:00 heroku[web.1]: Process exited with status 1
2019-04-16T17:46:21.962948+00:00 app[web.1]: internal/modules/cjs/loader.js:584
2019-04-16T17:46:21.962978+00:00 app[web.1]: throw err;
2019-04-16T17:46:21.962980+00:00 app[web.1]: ^
2019-04-16T17:46:21.962981+00:00 app[web.1]:
2019-04-16T17:46:21.962983+00:00 app[web.1]: Error: Cannot find module '/app/app.js'
2019-04-16T17:46:21.962985+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-04-16T17:46:21.962987+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
2019-04-16T17:46:21.962989+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
2019-04-16T17:46:21.962991+00:00 app[web.1]: at startup (internal/bootstrap/node.js:283:19)
2019-04-16T17:46:21.962992+00:00 app[web.1]: at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
2019-04-16T17:46:22.320545+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=loveplumbing.herokuapp.com request_id=a8e86470-1fee-4159-a683-a4437e46ccbc fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:46:23.689417+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=loveplumbing.herokuapp.com request_id=a7e1403a-3ee9-490f-9446-b4d8150761ee fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:49:56.610263+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=loveplumbing.herokuapp.com request_id=fac4cd8f-dfce-4023-bc1d-e27e3297cd59 fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
2019-04-16T17:49:57.055698+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=loveplumbing.herokuapp.com request_id=b431c26e-62c1-42ca-908d-bbe70be171e4 fwd="99.34.148.220" dyno= connect= service= status=503 bytes= protocol=https
I expect it will be some sort of file naming issue.
Well, according to your error messages
Error: Cannot find module '/app/app.js'
I believe it is trying to find your app.js which is I guess it should be your index.js. What exactly are you using? Angular? If so, check this link as it helped me to understand how to set up an angular project to deploy to heroku.
https://medium.com/#hellotunmbi/how-to-deploy-angular-application-to-heroku-1d56e09c5147

NPM error in Node.js

I'm trying to do Todo routes deployed on Heroku successfully but shows application error. When checked the heroku logs file it shows the following error mentioned in Log file
I have used node.js mongodb mongoose and Heroku to deploy with mlab
Node version
Node version node : 8.11.2
Log file
2018-06-23T10:53:43.168794+00:00 app[web.1]: npm ERR! spawn ENOENT
2018-06-23T10:53:43.169086+00:00 app[web.1]: npm ERR!
2018-06-23T10:53:43.169299+00:00 app[web.1]: npm ERR! Failed at the nodetodo#1.0.0 prestart script.
2018-06-23T10:53:43.169500+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-06-23T10:53:43.174385+00:00 app[web.1]:
2018-06-23T10:53:43.174622+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-06-23T10:53:43.174799+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2018-06-23T10_53_43_171Z-debug.log
2018-06-23T10:53:43.275561+00:00 heroku[web.1]: State changed from crashed to starting
2018-06-23T10:53:46.634454+00:00 heroku[web.1]: Starting process with command `npm start`
2018-06-23T10:53:49.572029+00:00 heroku[web.1]: Process exited with status 1
2018-06-23T10:53:49.589326+00:00 heroku[web.1]: State changed from starting to crashed
2018-06-23T10:53:49.452654+00:00 app[web.1]:
2018-06-23T10:53:49.452675+00:00 app[web.1]: > nodetodo#1.0.0 prestart /app
2018-06-23T10:53:49.452677+00:00 app[web.1]: > next build
2018-06-23T10:53:49.452678+00:00 app[web.1]:
2018-06-23T10:53:49.461849+00:00 app[web.1]: sh: 1: next: not found
2018-06-23T10:53:49.476477+00:00 app[web.1]: npm ERR! file sh
2018-06-23T10:53:49.476762+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2018-06-23T10:53:49.477051+00:00 app[web.1]: npm ERR! errno ENOENT
2018-06-23T10:53:49.477332+00:00 app[web.1]: npm ERR! syscall spawn
2018-06-23T10:53:49.479006+00:00 app[web.1]: npm ERR! nodetodo#1.0.0 prestart: `next build`
2018-06-23T10:53:49.479274+00:00 app[web.1]: npm ERR! spawn ENOENT
2018-06-23T10:53:49.479567+00:00 app[web.1]: npm ERR!
2018-06-23T10:53:49.479782+00:00 app[web.1]: npm ERR! Failed at the nodetodo#1.0.0 prestart script.
2018-06-23T10:53:49.479988+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-06-23T10:53:49.488380+00:00 app[web.1]:
2018-06-23T10:53:49.488650+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-06-23T10:53:49.488830+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2018-06-23T10_53_49_481Z-debug.log
2018-06-23T10:53:57.235315+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/todos" host=glacial-mesa-32050.herokuapp.com request_id=0cbc6b93-45b5-4e60-a716-6e87f9cfe8b5 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:53:57.875585+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-mesa-32050.herokuapp.com request_id=8a8c1304-b9ca-4684-8306-a70dca54e911 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:54:00.250909+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/todos" host=glacial-mesa-32050.herokuapp.com request_id=d4de12e1-d453-4a62-9ee0-4a99e2f78051 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:54:00.896607+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-mesa-32050.herokuapp.com request_id=8e52a8d5-2bd2-4e95-a8e6-7e43c21bd369 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:54:04.255637+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/todos" host=glacial-mesa-32050.herokuapp.com request_id=8d68216f-f176-4f79-91b5-cb10b02c8fc3 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:54:04.866164+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-mesa-32050.herokuapp.com request_id=5ebf6203-d866-42ff-baf7-f57179248c73 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:54:06.844189+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/todos" host=glacial-mesa-32050.herokuapp.com request_id=11ce1294-b8a5-4046-ad2b-1db482422355 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:54:07.474661+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-mesa-32050.herokuapp.com request_id=98c0098c-c969-4491-99d3-aa6f29eb836f fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:57:10.708198+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=glacial-mesa-32050.herokuapp.com request_id=b3fc81b7-4a7a-438c-8482-e0b68b8e52d0 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:57:11.197790+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-mesa-32050.herokuapp.com request_id=b8c7fff9-7304-4e63-8fea-50d9e7525cf2 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:57:21.844958+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/todos" host=glacial-mesa-32050.herokuapp.com request_id=b0fa0c40-3fed-4da9-b680-6b55864ae418 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T10:57:24.013893+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-mesa-32050.herokuapp.com request_id=8b0ac5ed-ea76-4ee4-b1a8-99ba8520c986 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T11:05:45.000000+00:00 app[api]: Build started by user #gmail.com
2018-06-23T11:05:58.286485+00:00 app[api]: Deploy 6ab35c64 by user #gmail.com
2018-06-23T11:05:58.286485+00:00 app[api]: Release v5 created by user #gmail.com
2018-06-23T11:05:58.000000+00:00 app[api]: Build succeeded
2018-06-23T11:06:00.741880+00:00 heroku[web.1]: State changed from crashed to starting
2018-06-23T11:06:04.111616+00:00 heroku[web.1]: Starting process with command `npm start`
2018-06-23T11:06:06.707945+00:00 app[web.1]:
2018-06-23T11:06:06.707971+00:00 app[web.1]: > nodetodo#1.0.0 start /app
2018-06-23T11:06:06.707972+00:00 app[web.1]: > node server/server.js
2018-06-23T11:06:06.707974+00:00 app[web.1]:
2018-06-23T11:06:07.594283+00:00 app[web.1]: Started at port 38896
2018-06-23T11:06:07.622294+00:00 app[web.1]:
2018-06-23T11:06:07.622298+00:00 app[web.1]: /app/node_modules/mongoose/node_modules/mongodb/lib/server.js:242
2018-06-23T11:06:07.622300+00:00 app[web.1]: process.nextTick(function() { throw err; })
2018-06-23T11:06:07.622302+00:00 app[web.1]: ^
2018-06-23T11:06:07.622338+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0.1:27017
2018-06-23T11:06:07.622340+00:00 app[web.1]: at Object._errnoException (util.js:992:11)
2018-06-23T11:06:07.622342+00:00 app[web.1]: at _exceptionWithHostPort (util.js:1014:20)
2018-06-23T11:06:07.622344+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
2018-06-23T11:06:07.632652+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2018-06-23T11:06:07.633131+00:00 app[web.1]: npm ERR! errno 1
2018-06-23T11:06:07.634834+00:00 app[web.1]: npm ERR! nodetodo#1.0.0 start: `node server/server.js`
2018-06-23T11:06:07.635359+00:00 app[web.1]: npm ERR!
2018-06-23T11:06:07.635590+00:00 app[web.1]: npm ERR! Failed at the nodetodo#1.0.0 start script.
2018-06-23T11:06:07.635057+00:00 app[web.1]: npm ERR! Exit status 1
2018-06-23T11:06:07.635807+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-06-23T11:06:07.642357+00:00 app[web.1]:
2018-06-23T11:06:07.642642+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-06-23T11:06:07.642830+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2018-06-23T11_06_07_637Z-debug.log
2018-06-23T11:06:07.695625+00:00 heroku[web.1]: Process exited with status 1
2018-06-23T11:06:07.822414+00:00 heroku[web.1]: State changed from starting to crashed
2018-06-23T11:06:07.826000+00:00 heroku[web.1]: State changed from crashed to starting
2018-06-23T11:06:10.546996+00:00 heroku[web.1]: Starting process with command `npm start`
2018-06-23T11:06:12.650782+00:00 app[web.1]:
2018-06-23T11:06:12.650804+00:00 app[web.1]: > nodetodo#1.0.0 start /app
2018-06-23T11:06:12.650806+00:00 app[web.1]: > node server/server.js
2018-06-23T11:06:12.650807+00:00 app[web.1]:
2018-06-23T11:06:13.248399+00:00 app[web.1]: Started at port 4126
2018-06-23T11:06:13.264689+00:00 app[web.1]:
2018-06-23T11:06:13.264697+00:00 app[web.1]: process.nextTick(function() { throw err; })
2018-06-23T11:06:13.264695+00:00 app[web.1]: /app/node_modules/mongoose/node_modules/mongodb/lib/server.js:242
2018-06-23T11:06:13.264699+00:00 app[web.1]: ^
2018-06-23T11:06:13.264700+00:00 app[web.1]: Error: connect ECONNREFUSED 127.0.0.1:27017
2018-06-23T11:06:13.264701+00:00 app[web.1]: at Object._errnoException (util.js:992:11)
2018-06-23T11:06:13.264703+00:00 app[web.1]: at _exceptionWithHostPort (util.js:1014:20)
2018-06-23T11:06:13.264705+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
2018-06-23T11:06:13.271195+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2018-06-23T11:06:13.271503+00:00 app[web.1]: npm ERR! errno 1
2018-06-23T11:06:13.272534+00:00 app[web.1]: npm ERR! nodetodo#1.0.0 start: `node server/server.js`
2018-06-23T11:06:13.272816+00:00 app[web.1]: npm ERR!
2018-06-23T11:06:13.272926+00:00 app[web.1]: npm ERR! Failed at the nodetodo#1.0.0 start script.
2018-06-23T11:06:13.272642+00:00 app[web.1]: npm ERR! Exit status 1
2018-06-23T11:06:13.273028+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-06-23T11:06:13.276839+00:00 app[web.1]:
2018-06-23T11:06:13.276972+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-06-23T11:06:13.277055+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2018-06-23T11_06_13_274Z-debug.log
2018-06-23T11:06:13.324927+00:00 heroku[web.1]: Process exited with status 1
2018-06-23T11:06:13.471063+00:00 heroku[web.1]: State changed from starting to crashed
2018-06-23T11:06:20.993262+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=glacial-mesa-32050.herokuapp.com request_id=6458108b-77d2-485c-ba53-9e523f8fff7f fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
2018-06-23T11:06:21.472089+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-mesa-32050.herokuapp.com request_id=dc99750e-aaba-4fc9-b7f5-fde727eb6201 fwd="111.91.116.52" dyno= connect= service= status=503 bytes= protocol=https
JSON file
{
"name": "nodetodo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node server/server.js",
"test": "mocha server/**/*.test.js",
"test-watch": "nodemon --exec \"npm test\""
},
"engines": {
"node": "8.11.2"
},
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.18.3",
"express": "^4.16.3",
"mongodb": "^2.2.35",
"mongoose": "^4.5.9"
},
"devDependencies": {
"expect": "^1.20.2",
"mocha": "^3.0.2",
"nodemon": "^1.10.2",
"supertest": "^2.0.0"
}
}
Please help
Have you tried npm cache clean -f ?
Okay, this error could be due to two reasons, so make sure you have followed these steps right
Make sure to bind your port
const PORT = process.env.PORT || 4126;
app.listen(PORT);
Make sure that you connect to online database and not to your local database.Use mlab uri. https://mlab.com/ Use this link for help Learn Mlab

Node.js Heroku App application error. Trouble with logs

I'm new to heroku and when running my node.js app for the first time I get an application error. I have trouble discerning what exactly is the issue since the program runs fine locally. Here is the log. I can post the node.js code if need be, but specfically I know
http.listen(process.env.PORT || 3000, function(){
console.log('listening on *:3000');
});
should be right
2016-06-06T23:38:54.950995+00:00 heroku[api]: Release v2 created by 96benchu#gmail.com
2016-06-06T23:38:54.950923+00:00 heroku[api]: Enable Logplex by 96benchu#gmail.com
2016-06-06T23:39:20.282705+00:00 heroku[api]: Scale to web=1 by 96benchu#gmail.com
2016-06-06T23:39:20.283517+00:00 heroku[api]: Deploy 5244c81 by 96benchu#gmail.com
2016-06-06T23:39:20.283586+00:00 heroku[api]: Release v3 created by 96benchu#gmail.com
2016-06-06T23:39:20.707206+00:00 heroku[slug-compiler]: Slug compilation started
2016-06-06T23:39:20.707211+00:00 heroku[slug-compiler]: Slug compilation finished
2016-06-06T23:39:22.230869+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-06T23:39:24.373251+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-06T23:39:24.373791+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-06T23:39:24.374028+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-06T23:39:24.374471+00:00 app[web.1]: npm ERR! npm v3.8.6
2016-06-06T23:39:24.375629+00:00 app[web.1]:
2016-06-06T23:39:24.376442+00:00 app[web.1]: npm ERR! missing script: start
2016-06-06T23:39:24.376571+00:00 app[web.1]: npm ERR!
2016-06-06T23:39:24.376669+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-06T23:39:24.376763+00:00 app[web.1]: npm ERR! <https://github.com/npm/npm/issues>
2016-06-06T23:39:24.384251+00:00 app[web.1]:
2016-06-06T23:39:24.384417+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-06T23:39:24.384520+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-06-06T23:39:25.117419+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-06T23:39:25.118722+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-06T23:39:25.105763+00:00 heroku[web.1]: Process exited with status 1
2016-06-06T23:39:26.845316+00:00 heroku[web.1]: Starting process with command `npm start`
2016-06-06T23:39:30.360228+00:00 app[web.1]: npm ERR! Linux 3.13.0-85-generic
2016-06-06T23:39:30.360970+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-06-06T23:39:30.361314+00:00 app[web.1]: npm ERR! node v5.11.1
2016-06-06T23:39:30.362144+00:00 app[web.1]: npm ERR! npm v3.8.6
2016-06-06T23:39:30.364140+00:00 app[web.1]:
2016-06-06T23:39:30.365320+00:00 app[web.1]: npm ERR! missing script: start
2016-06-06T23:39:30.365478+00:00 app[web.1]: npm ERR!
2016-06-06T23:39:30.365600+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2016-06-06T23:39:30.365735+00:00 app[web.1]: npm ERR! <https://github.com/npm/npm/issues>
2016-06-06T23:39:30.381812+00:00 app[web.1]:
2016-06-06T23:39:30.382074+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-06-06T23:39:30.382233+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-06-06T23:39:31.427206+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-06T23:39:31.409170+00:00 heroku[web.1]: Process exited with status 1
2016-06-06T23:40:10.611044+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=secret-eyrie-35026.herokuapp.com request_id=9e530180-b522-4412-a321-54b90430b82f fwd="172.6.205.107" dyno= connect= service= status=503 bytes=
2016-06-06T23:40:11.404313+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=secret-eyrie-35026.herokuapp.com request_id=f039df37-b206-41df-80b8-5076330ae67f fwd="172.6.205.107" dyno= connect= service= status=503 bytes=
2016-06-06T23:41:02.960874+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=secret-eyrie-35026.herokuapp.com request_id=0ad763f1-7a6f-4324-b9ad-f81891d4ccba fwd="172.6.205.107" dyno= connect= service= status=503 bytes=
2016-06-06T23:41:03.729436+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=secret-eyrie-35026.herokuapp.com request_id=790a0e38-360c-447d-80a6-fa57914faf15 fwd="172.6.205.107" dyno= connect= service= status=503 bytes=
You can add start script in your package.json like following:
"scripts": {
"start": "node index.js"
},
so that your package.json will look like following:
{
"name": "socket-chat-example",
"version": "0.0.1",
"description": "my first socket.io app",
"scripts": {
"start": "node index.js"
},
"dependencies": { "express": "~4.10.2", "socket.io": "1.2.0", }
}

CSS and JS files loading offline but not when deployed on Heroku

I ran into trouble when I deployed my application to Heroku. The build succeeds but for some reason my application is not retrieving the CSS or JS files online. I am using Node.js.
2015-12-23T02:31:28.107602+00:00 heroku[api]: Release v174 created by averybentz#bell.net
2015-12-23T02:31:28.249227+00:00 heroku[slug-compiler]: Slug compilation started
2015-12-23T02:31:28.249232+00:00 heroku[slug-compiler]: Slug compilation finished
2015-12-23T02:31:28.399932+00:00 heroku[web.1]: State changed from up to starting
2015-12-23T02:31:29.599898+00:00 heroku[web.1]: Starting process with command `node index.js`
2015-12-23T02:31:31.936570+00:00 heroku[web.1]: State changed from starting to up
2015-12-23T02:31:35.233051+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-12-23T02:31:38.666073+00:00 heroku[web.1]: Process exited with status 143
2015-12-23T02:31:43.695902+00:00 heroku[router]: at=info method=GET path="/" host=allert.herokuapp.com request_id=22c9274d-bf9d-4923-b698-95814e83b2d6 fwd="142.113.215.26" dyno=web.1 connect=1ms service=30ms status=304 bytes=146
2015-12-23T02:31:43.772913+00:00 heroku[router]: at=info method=GET path="/style.css" host=allert.herokuapp.com request_id=10519bb7-dae8-496a-b1b2-3a846ebe8a0c fwd="142.113.215.26" dyno=web.1 connect=1ms service=39ms status=404 bytes=220
2015-12-23T02:31:43.757781+00:00 heroku[router]: at=info method=GET path="/placeholder.js" host=allert.herokuapp.com request_id=a74736e9-1265-440b-9253-04b0460a620c fwd="142.113.215.26" dyno=web.1 connect=1ms service=19ms status=404 bytes=225
2015-12-23T02:34:06.094848+00:00 heroku[api]: Deploy 1b0351b by averybentz#bell.net
2015-12-23T02:34:06.094848+00:00 heroku[api]: Release v175 created by averybentz#bell.net
2015-12-23T02:34:06.227485+00:00 heroku[slug-compiler]: Slug compilation started
2015-12-23T02:34:06.227495+00:00 heroku[slug-compiler]: Slug compilation finished
2015-12-23T02:34:07.634148+00:00 heroku[web.1]: State changed from up to starting
2015-12-23T02:34:08.607774+00:00 heroku[web.1]: Starting process with command `node index.js`
2015-12-23T02:34:10.543910+00:00 app[web.1]: /app/node_modules/express/lib/application.js:209
2015-12-23T02:34:10.543951+00:00 app[web.1]: throw new TypeError('app.use() requires middleware functions');
2015-12-23T02:34:10.543963+00:00 app[web.1]: ^
2015-12-23T02:34:10.543974+00:00 app[web.1]:
2015-12-23T02:34:10.543986+00:00 app[web.1]: TypeError: app.use() requires middleware functions
2015-12-23T02:34:10.543988+00:00 app[web.1]: at Object.<anonymous> (/app/index.js:8:5)
2015-12-23T02:34:10.543987+00:00 app[web.1]: at EventEmitter.use (/app/node_modules/express/lib/application.js:209:11)
2015-12-23T02:34:10.543989+00:00 app[web.1]: at Module._compile (module.js:425:26)
2015-12-23T02:34:10.543989+00:00 app[web.1]: at Object.Module._extensions..js (module.js:432:10)
2015-12-23T02:34:10.543990+00:00 app[web.1]: at Module.load (module.js:356:32)
2015-12-23T02:34:10.543990+00:00 app[web.1]: at Function.Module._load (module.js:313:12)
2015-12-23T02:34:10.543991+00:00 app[web.1]: at Function.Module.runMain (module.js:457:10)
2015-12-23T02:34:10.543992+00:00 app[web.1]: at startup (node.js:138:18)
2015-12-23T02:34:10.544003+00:00 app[web.1]: at node.js:974:3
2015-12-23T02:34:11.273463+00:00 heroku[web.1]: State changed from starting to crashed
2015-12-23T02:34:11.274404+00:00 heroku[web.1]: State changed from crashed to starting
2015-12-23T02:34:11.249687+00:00 heroku[web.1]: Process exited with status 1
2015-12-23T02:34:12.195648+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-12-23T02:34:12.163995+00:00 heroku[web.1]: Starting process with command `node index.js`
2015-12-23T02:34:14.005248+00:00 heroku[web.1]: Process exited with status 143
2015-12-23T02:34:14.208032+00:00 app[web.1]: /app/node_modules/express/lib/application.js:209
2015-12-23T02:34:14.208060+00:00 app[web.1]: throw new TypeError('app.use() requires middleware functions');
2015-12-23T02:34:14.208062+00:00 app[web.1]: ^
2015-12-23T02:34:14.208063+00:00 app[web.1]:
2015-12-23T02:34:14.208067+00:00 app[web.1]: TypeError: app.use() requires middleware functions
2015-12-23T02:34:14.208068+00:00 app[web.1]: at EventEmitter.use (/app/node_modules/express/lib/application.js:209:11)
2015-12-23T02:34:14.208069+00:00 app[web.1]: at Object.<anonymous> (/app/index.js:8:5)
2015-12-23T02:34:14.208069+00:00 app[web.1]: at Module._compile (module.js:425:26)
2015-12-23T02:34:14.208070+00:00 app[web.1]: at Object.Module._extensions..js (module.js:432:10)
2015-12-23T02:34:14.208070+00:00 app[web.1]: at Module.load (module.js:356:32)
2015-12-23T02:34:14.208071+00:00 app[web.1]: at Function.Module._load (module.js:313:12)
2015-12-23T02:34:14.208071+00:00 app[web.1]: at Function.Module.runMain (module.js:457:10)
2015-12-23T02:34:14.208072+00:00 app[web.1]: at startup (node.js:138:18)
2015-12-23T02:34:14.208073+00:00 app[web.1]: at node.js:974:3
2015-12-23T02:34:14.997397+00:00 heroku[web.1]: Process exited with status 1
2015-12-23T02:34:16.318032+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=allert.herokuapp.com request_id=21b5b175-c8c3-4338-b1ff-073c55ff4dac fwd="142.113.215.26" dyno= connect= service= status=503 bytes=
2015-12-23T02:34:15.054571+00:00 heroku[web.1]: State changed from starting to crashed
2015-12-23T02:34:46.713402+00:00 heroku[slug-compiler]: Slug compilation started
2015-12-23T02:34:46.713411+00:00 heroku[slug-compiler]: Slug compilation finished
2015-12-23T02:34:46.577987+00:00 heroku[api]: Deploy c6fd6f1 by averybentz#bell.net
2015-12-23T02:34:46.577987+00:00 heroku[api]: Release v176 created by averybentz#bell.net
2015-12-23T02:34:46.701946+00:00 heroku[web.1]: State changed from crashed to starting
2015-12-23T02:34:47.557807+00:00 heroku[web.1]: Starting process with command `node index.js`
2015-12-23T02:34:50.042760+00:00 heroku[web.1]: State changed from starting to up
2015-12-23T03:07:57.567678+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-12-23T03:07:59.713608+00:00 heroku[web.1]: Process exited with status 143
2015-12-23T03:07:53.346047+00:00 heroku[web.1]: Idling
2015-12-23T03:07:53.346422+00:00 heroku[web.1]: State changed from up to down
2015-12-23T16:22:11.989654+00:00 heroku[api]: Starting process with command `rake db:migrate` by averybentz#bell.net
2015-12-23T16:22:13.750043+00:00 heroku[run.2637]: Starting process with command `rake db:migrate`
2015-12-23T16:22:13.713201+00:00 heroku[run.2637]: Awaiting client
2015-12-23T16:22:14.013741+00:00 heroku[run.2637]: State changed from starting to up
2015-12-23T16:22:16.241635+00:00 heroku[run.2637]: State changed from up to complete
2015-12-23T16:22:16.224832+00:00 heroku[run.2637]: Process exited with status 127
2015-12-23T16:23:12.741395+00:00 heroku[api]: Starting process with command `rake db:migrate` by averybentz#bell.net
2015-12-23T16:23:13.915645+00:00 heroku[run.8207]: Awaiting client
2015-12-23T16:23:13.936338+00:00 heroku[run.8207]: Starting process with command `rake db:migrate`
2015-12-23T16:23:14.252137+00:00 heroku[run.8207]: State changed from starting to up
2015-12-23T16:23:15.489691+00:00 heroku[run.8207]: Process exited with status 127
2015-12-23T16:23:15.526095+00:00 heroku[run.8207]: State changed from up to complete
2015-12-23T16:27:33.180438+00:00 heroku[api]: Deploy f63f788 by averybentz#bell.net
2015-12-23T16:27:33.180438+00:00 heroku[api]: Release v177 created by averybentz#bell.net
2015-12-23T16:27:33.322549+00:00 heroku[slug-compiler]: Slug compilation started
2015-12-23T16:27:33.322560+00:00 heroku[slug-compiler]: Slug compilation finished
2015-12-23T20:34:47.337524+00:00 heroku[api]: Deploy fc8a2a6 by averybentz#bell.net
2015-12-23T20:34:47.337524+00:00 heroku[api]: Release v178 created by averybentz#bell.net
2015-12-23T20:34:47.477567+00:00 heroku[slug-compiler]: Slug compilation started
2015-12-23T20:34:47.477591+00:00 heroku[slug-compiler]: Slug compilation finished
2015-12-23T20:34:56.089225+00:00 heroku[web.1]: Starting process with command `node index.js`
2015-12-23T20:34:55.197826+00:00 heroku[web.1]: Unidling
2015-12-23T20:34:55.198252+00:00 heroku[web.1]: State changed from down to starting
2015-12-23T20:34:58.238986+00:00 heroku[web.1]: State changed from starting to up
2015-12-23T20:34:59.290400+00:00 heroku[router]: at=info method=GET path="/" host=allert.herokuapp.com request_id=3c539404-e0bc-4878-b856-ccfaea4559d6 fwd="142.113.215.26" dyno=web.1 connect=2ms service=22ms status=200 bytes=1892
2015-12-23T20:34:59.370781+00:00 heroku[router]: at=info method=GET path="/placeholder.js" host=allert.herokuapp.com request_id=24115a3e-f28f-46b3-b49d-2dd75ff4ea80 fwd="142.113.215.26" dyno=web.1 connect=4ms service=7ms status=404 bytes=225
2015-12-23T20:34:59.352933+00:00 heroku[router]: at=info method=GET path="/style.css" host=allert.herokuapp.com request_id=8635dc7c-8dab-4518-9d93-c108a5a7274f fwd="142.113.215.26" dyno=web.1 connect=2ms service=7ms status=404 bytes=220
2015-12-23T20:35:06.061489+00:00 heroku[router]: at=info method=GET path="/placeholder.js" host=allert.herokuapp.com request_id=b2e00361-7561-4a5d-86c3-bfbd445c1195 fwd="142.113.215.26" dyno=web.1 connect=2ms service=2ms status=404 bytes=225
2015-12-23T20:35:06.073592+00:00 heroku[router]: at=info method=GET path="/style.css" host=allert.herokuapp.com request_id=77220e8e-d7f3-486b-8240-122ff34d28d5 fwd="142.113.215.26" dyno=web.1 connect=2ms service=3ms status=404 bytes=220
2015-12-23T20:35:06.026126+00:00 heroku[router]: at=info method=GET path="/?username=&password=" host=allert.herokuapp.com request_id=a0d0909c-1dd8-4d5f-985b-23c8d15eb972 fwd="142.113.215.26" dyno=web.1 connect=16ms service=8ms status=200 bytes=1892
2015-12-23T20:35:06.671874+00:00 heroku[router]: at=info method=GET path="/placeholder.js" host=allert.herokuapp.com request_id=d44efef6-7ed5-4fa5-b9cb-5be321054272 fwd="142.113.215.26" dyno=web.1 connect=5ms service=4ms status=404 bytes=225
2015-12-23T20:35:06.603304+00:00 heroku[router]: at=info method=GET path="/?username=&password=" host=allert.herokuapp.com request_id=e048945d-f7cc-4737-bc15-54ff205e7a27 fwd="142.113.215.26" dyno=web.1 connect=2ms service=4ms status=304 bytes=146
2015-12-23T20:35:06.649798+00:00 heroku[router]: at=info method=GET path="/style.css" host=allert.herokuapp.com request_id=ecfbf3d9-e6d4-41e6-a98b-60a4bb42d1a0 fwd="142.113.215.26" dyno=web.1 connect=2ms service=5ms status=404 bytes=220
2015-12-23T20:35:07.283559+00:00 heroku[router]: at=info method=GET path="/?username=&password=" host=allert.herokuapp.com request_id=f786f940-c163-45a0-87f1-2e40681d1a44 fwd="142.113.215.26" dyno=web.1 connect=2ms service=3ms status=304 bytes=146
2015-12-23T20:35:07.336974+00:00 heroku[router]: at=info method=GET path="/style.css" host=allert.herokuapp.com request_id=7fd25be7-7030-4f7b-a974-410185d5ed36 fwd="142.113.215.26" dyno=web.1 connect=11ms service=3ms status=404 bytes=220
2015-12-23T20:35:07.314908+00:00 heroku[router]: at=info method=GET path="/placeholder.js" host=allert.herokuapp.com request_id=a522768d-5171-4300-a435-c6669326015b fwd="142.113.215.26" dyno=web.1 connect=2ms service=2ms status=404 bytes=225
I am assuming that Heroku has some security against src files or something along those lines. Any help would be appreciated. Thanks in advance.
Your app has a bug here:
2015-12-23T02:34:14.208032+00:00 app[web.1]: /app/node_modules/express/lib/application.js:209
2015-12-23T02:34:14.208060+00:00 app[web.1]: throw new TypeError('app.use() requires middleware functions');
2015-12-23T02:34:14.208062+00:00 app[web.1]: ^
2015-12-23T02:34:14.208063+00:00 app[web.1]:
2015-12-23T02:34:14.208067+00:00 app[web.1]: TypeError: app.use() requires middleware functions
2015-12-23T02:34:14.208068+00:00 app[web.1]: at EventEmitter.use (/app/node_modules/express/lib/application.js:209:11)
2015-12-23T02:34:14.208069+00:00 app[web.1]: at Object.<anonymous> (/app/index.js:8:5)
2015-12-23T02:34:14.208069+00:00 app[web.1]: at Module._compile (module.js:425:26)
2015-12-23T02:34:14.208070+00:00 app[web.1]: at Object.Module._extensions..js (module.js:432:10)
2015-12-23T02:34:14.208070+00:00 app[web.1]: at Module.load (module.js:356:32)
2015-12-23T02:34:14.208071+00:00 app[web.1]: at Function.Module._load (module.js:313:12)
2015-12-23T02:34:14.208071+00:00 app[web.1]: at Function.Module.runMain (module.js:457:10)
2015-12-23T02:34:14.208072+00:00 app[web.1]: at startup (node.js:138:18)
2015-12-23T02:34:14.208073+00:00 app[web.1]: at node.js:974:3
2015-12-23T02:34:14.997397+00:00 heroku[web.1]: Process exited with status 1
2015-12-23T02:34:16.318032+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=allert.herokuapp.com request_id=21b5b175-c8c3-4338-b1ff-073c55ff4dac fwd="142.113.215.26" dyno= connect= service= status=503 bytes=
2015-12-23T02:34:15.054571+00:00 heroku[web.1]: State changed from starting to crashed
Check line 8 of your index.js file. It's passing something to express that express doesn't understand.
Heroku doesn't display static files. I hosted them on Amazon S3 and the site is now working.

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