I'm attempting to launch my MERN stack app with Heroku, it works on my localhost but following the directions for heroku, I keep getting this H10 error and I feel like it is something trivial that I've missed. I've hit a wall.
I've looked at the logs, and nothing was helpful, changed the URL, updated the package.json. I originally had too many pkg.json (one in the main folder and one in each of the front and backends), deleted the main folder pkg.json, it's not a node error
heroku logs
2019-05-06T01:22:20.905343+00:00 heroku[web.1]: State changed from crashed to starting
2019-05-06T01:22:20.635909+00:00 app[web.1]: > coding-challenge#1.0.0 start /app
2019-05-06T01:22:20.635910+00:00 app[web.1]: > node server.js
2019-05-06T01:22:20.826762+00:00 app[web.1]: internal/modules/cjs/loader.js:611
2019-05-06T01:22:20.826766+00:00 app[web.1]: throw err;
2019-05-06T01:22:20.826768+00:00 app[web.1]: ^
2019-05-06T01:22:20.826771+00:00 app[web.1]: Error: Cannot find module 'cors'
2019-05-06T01:22:20.826773+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
2019-05-06T01:22:20.826775+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:535:25)
2019-05-06T01:22:20.826776+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:663:17)
2019-05-06T01:22:20.826777+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:20:18)
2019-05-06T01:22:20.826779+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:14)
2019-05-06T01:22:20.826780+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:734:30)
2019-05-06T01:22:20.826781+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
2019-05-06T01:22:20.826782+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:626:32)
2019-05-06T01:22:20.826783+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
2019-05-06T01:22:20.826785+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:558:3)
2019-05-06T01:22:20.833856+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-05-06T01:22:20.834362+00:00 app[web.1]: npm ERR! errno 1
2019-05-06T01:22:20.835547+00:00 app[web.1]: npm ERR! coding-challenge#1.0.0 start: `node server.js`
2019-05-06T01:22:20.835696+00:00 app[web.1]: npm ERR! Exit status 1
2019-05-06T01:22:20.835933+00:00 app[web.1]: npm ERR!
2019-05-06T01:22:20.836101+00:00 app[web.1]: npm ERR! Failed at the coding-challenge#1.0.0 start script.
2019-05-06T01:22:20.836250+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-05-06T01:22:20.843776+00:00 app[web.1]:
2019-05-06T01:22:20.843920+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-05-06T01:22:20.844004+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-05-06T01_22_20_837Z-debug.log
2019-05-06T01:22:20.885179+00:00 heroku[web.1]: Process exited with status 1
2019-05-06T01:22:23.822929+00:00 heroku[web.1]: Starting process with command `npm start`
2019-05-06T01:22:26.506313+00:00 heroku[web.1]: State changed from starting to crashed
2019-05-06T01:22:26.221158+00:00 app[web.1]:
2019-05-06T01:22:26.221187+00:00 app[web.1]: > coding-challenge#1.0.0 start /app
2019-05-06T01:22:26.221190+00:00 app[web.1]: > node server.js
2019-05-06T01:22:26.221192+00:00 app[web.1]:
2019-05-06T01:22:26.431669+00:00 app[web.1]: internal/modules/cjs/loader.js:611
2019-05-06T01:22:26.431673+00:00 app[web.1]: throw err;
2019-05-06T01:22:26.431674+00:00 app[web.1]: ^
2019-05-06T01:22:26.431676+00:00 app[web.1]:
2019-05-06T01:22:26.431678+00:00 app[web.1]: Error: Cannot find module 'cors'
2019-05-06T01:22:26.431680+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
2019-05-06T01:22:26.431682+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:535:25)
2019-05-06T01:22:26.431684+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:663:17)
2019-05-06T01:22:26.431687+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:20:18)
2019-05-06T01:22:26.431688+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:14)
2019-05-06T01:22:26.431690+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:734:30)
2019-05-06T01:22:26.431692+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
2019-05-06T01:22:26.431694+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:626:32)
2019-05-06T01:22:26.431695+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
2019-05-06T01:22:26.431697+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:558:3)
2019-05-06T01:22:26.438865+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-05-06T01:22:26.439262+00:00 app[web.1]: npm ERR! errno 1
2019-05-06T01:22:26.440416+00:00 app[web.1]: npm ERR! coding-challenge#1.0.0 start: `node server.js`
2019-05-06T01:22:26.440555+00:00 app[web.1]: npm ERR! Exit status 1
2019-05-06T01:22:26.440783+00:00 app[web.1]: npm ERR!
2019-05-06T01:22:26.440937+00:00 app[web.1]: npm ERR! Failed at the coding-challenge#1.0.0 start script.
2019-05-06T01:22:26.441081+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-05-06T01:22:26.448596+00:00 app[web.1]:
2019-05-06T01:22:26.448750+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-05-06T01:22:26.448803+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-05-06T01_22_26_442Z-debug.log
2019-05-06T01:22:26.493385+00:00 heroku[web.1]: Process exited with status 1
2019-05-06T01:45:52.690438+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-wildwood-76480.herokuapp.com request_id=b1c76bb1-2948-45cd-929b-b579eb45e29b fwd="24.192.243.229" dyno= connect= service= status=503 bytes= protocol=https
2019-05-06T01:45:54.362863+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-wildwood-76480.herokuapp.com request_id=df6c81f1-df99-4d50-af11-baff32648e77 fwd="24.192.243.229" dyno= connect= service= status=503 bytes= protocol=https
2019-05-06T01:53:45.184100+00:00 heroku[web.1]: State changed from crashed to starting
2019-05-06T01:53:48.182538+00:00 heroku[web.1]: Starting process with command `npm start`
2019-05-06T01:53:51.404026+00:00 heroku[web.1]: State changed from starting to crashed
2019-05-06T01:53:50.980526+00:00 app[web.1]:
2019-05-06T01:53:50.980548+00:00 app[web.1]: > coding-challenge#1.0.0 start /app
2019-05-06T01:53:50.980551+00:00 app[web.1]: > node server.js
2019-05-06T01:53:50.980552+00:00 app[web.1]:
2019-05-06T01:53:51.263052+00:00 app[web.1]: internal/modules/cjs/loader.js:611
2019-05-06T01:53:51.263083+00:00 app[web.1]: throw err;
2019-05-06T01:53:51.263084+00:00 app[web.1]: ^
2019-05-06T01:53:51.263086+00:00 app[web.1]:
2019-05-06T01:53:51.263087+00:00 app[web.1]: Error: Cannot find module 'cors'
2019-05-06T01:53:51.263089+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
2019-05-06T01:53:51.263091+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:535:25)
2019-05-06T01:53:51.263093+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:663:17)
2019-05-06T01:53:51.263094+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:20:18)
2019-05-06T01:53:51.263096+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:14)
2019-05-06T01:53:51.263097+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:734:30)
2019-05-06T01:53:51.263099+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
2019-05-06T01:53:51.263100+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:626:32)
2019-05-06T01:53:51.263102+00:00 app[web.1]: at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
2019-05-06T01:53:51.263103+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:558:3)
2019-05-06T01:53:51.274764+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-05-06T01:53:51.274769+00:00 app[web.1]: npm ERR! errno 1
2019-05-06T01:53:51.278740+00:00 app[web.1]: npm ERR! coding-challenge#1.0.0 start: `node server.js`
2019-05-06T01:53:51.278744+00:00 app[web.1]: npm ERR! Exit status 1
2019-05-06T01:53:51.278746+00:00 app[web.1]: npm ERR!
2019-05-06T01:53:51.278748+00:00 app[web.1]: npm ERR! Failed at the coding-challenge#1.0.0 start script.
2019-05-06T01:53:51.278750+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-05-06T01:53:51.287320+00:00 app[web.1]:
2019-05-06T01:53:51.287325+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-05-06T01:53:51.287327+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2019-05-06T01_53_51_279Z-debug.log
2019-05-06T01:53:51.386095+00:00 heroku[web.1]: Process exited with status 1
2019-05-06T02:07:06.872526+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=intense-wildwood-76480.herokuapp.com request_id=c14c2030-244d-469e-8953-d99d8e1d6fe8 fwd="24.192.243.229" dyno= connect= service= status=503 bytes= protocol=https
2019-05-06T02:07:08.695039+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=intense-wildwood-76480.herokuapp.com request_id=3532bee8-9b55-43ed-87ec-9bd7c2706efb fwd="24.192.243.229" dyno= connect= service= status=503 bytes= protocol=https
Looks like the module cors hasn't been installed. I think Heroku should automatically run npm install in your project for you, but you have to list the dependencies in your package.json.
Inside package.json do you have the cors dependency inside the dependencies object? If not you should add it so it looks something like
// package.json
{
"dependencies": {
"cors": "*"
}
}
Related
I was trying to deploy my discord.js bot on heroku but I always get an error and the bot crashes. I codes are fine, I ran it on my pc and it does not give any errors. I followed this link to set up my heroku app https://devcenter.heroku.com/articles/getting-started-with-nodejs#set-up. I did exactly as it said but I get this error:
2021-10-12T08:15:45.604131+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-12T08:15:46.708903+00:00 app[web.1]:
2021-10-12T08:15:46.709032+00:00 app[web.1]: > kurumi#1.0.0 start /app
2021-10-12T08:15:46.709036+00:00 app[web.1]: > node index.js
2021-10-12T08:15:46.709036+00:00 app[web.1]:
2021-10-12T08:15:46.772460+00:00 app[web.1]: /app/node_modules/discord.js/src/rest/APIRequest.js:33
2021-10-12T08:15:46.772464+00:00 app[web.1]: agent ??= new https.Agent({ ...this.client.options.http.agent, keepAlive: true });
2021-10-12T08:15:46.772465+00:00 app[web.1]: ^^^
2021-10-12T08:15:46.772465+00:00 app[web.1]:
2021-10-12T08:15:46.772468+00:00 app[web.1]: SyntaxError: Unexpected token '??='
2021-10-12T08:15:46.772468+00:00 app[web.1]: at wrapSafe (internal/modules/cjs/loader.js:1001:16)
2021-10-12T08:15:46.772468+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1049:27)
2021-10-12T08:15:46.772471+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-10-12T08:15:46.772471+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:950:32)
2021-10-12T08:15:46.772471+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:790:12)
2021-10-12T08:15:46.772471+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:974:19)
2021-10-12T08:15:46.772472+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:93:18)
2021-10-12T08:15:46.772472+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/discord.js/src/rest/RESTManager.js:4:20)
2021-10-12T08:15:46.772472+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14)
2021-10-12T08:15:46.772472+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-10-12T08:15:46.779715+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-10-12T08:15:46.779895+00:00 app[web.1]: npm ERR! errno 1
2021-10-12T08:15:46.783479+00:00 app[web.1]: npm ERR! kurumi#1.0.0 start: `node index.js`
2021-10-12T08:15:46.783529+00:00 app[web.1]: npm ERR! Exit status 1
2021-10-12T08:15:46.783595+00:00 app[web.1]: npm ERR!
2021-10-12T08:15:46.783640+00:00 app[web.1]: npm ERR! Failed at the kurumi#1.0.0 start script.
2021-10-12T08:15:46.783698+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-12T08:15:46.786955+00:00 app[web.1]:
2021-10-12T08:15:46.787031+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-12T08:15:46.787064+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-10-12T08_15_46_784Z-debug.log
2021-10-12T08:15:46.938086+00:00 heroku[web.1]: Process exited with status 1
2021-10-12T08:15:47.109411+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-12T08:15:47.120433+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-12T08:15:50.000000+00:00 app[api]: Build succeeded
2021-10-12T08:15:51.902833+00:00 heroku[web.1]: Starting process with command `npm start`
2021-10-12T08:15:52.879739+00:00 app[web.1]:
2021-10-12T08:15:52.879754+00:00 app[web.1]: > kurumi#1.0.0 start /app
2021-10-12T08:15:52.879755+00:00 app[web.1]: > node index.js
2021-10-12T08:15:52.879755+00:00 app[web.1]:
2021-10-12T08:15:52.943619+00:00 app[web.1]: /app/node_modules/discord.js/src/rest/APIRequest.js:33
2021-10-12T08:15:52.943621+00:00 app[web.1]: agent ??= new https.Agent({ ...this.client.options.http.agent, keepAlive: true });
2021-10-12T08:15:52.943621+00:00 app[web.1]: ^^^
2021-10-12T08:15:52.943622+00:00 app[web.1]:
2021-10-12T08:15:52.943622+00:00 app[web.1]: SyntaxError: Unexpected token '??='
2021-10-12T08:15:52.943623+00:00 app[web.1]: at wrapSafe (internal/modules/cjs/loader.js:1001:16)
2021-10-12T08:15:52.943623+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1049:27)
2021-10-12T08:15:52.943624+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-10-12T08:15:52.943624+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:950:32)
2021-10-12T08:15:52.943624+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:790:12)
2021-10-12T08:15:52.943625+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:974:19)
2021-10-12T08:15:52.943625+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:93:18)
2021-10-12T08:15:52.943625+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/discord.js/src/rest/RESTManager.js:4:20)
2021-10-12T08:15:52.943627+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1085:14)
2021-10-12T08:15:52.943627+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-10-12T08:15:52.950345+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-10-12T08:15:52.950523+00:00 app[web.1]: npm ERR! errno 1
2021-10-12T08:15:52.953970+00:00 app[web.1]: npm ERR! kurumi#1.0.0 start: `node index.js`
2021-10-12T08:15:52.954012+00:00 app[web.1]: npm ERR! Exit status 1
2021-10-12T08:15:52.954061+00:00 app[web.1]: npm ERR!
2021-10-12T08:15:52.954092+00:00 app[web.1]: npm ERR! Failed at the kurumi#1.0.0 start script.
2021-10-12T08:15:52.954134+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-10-12T08:15:52.956414+00:00 app[web.1]:
2021-10-12T08:15:52.956490+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-10-12T08:15:52.956517+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-10-12T08_15_52_954Z-debug.log
2021-10-12T08:15:53.132196+00:00 heroku[web.1]: Process exited with status 1
2021-10-12T08:15:53.198551+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-12T08:16:14.979868+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gentle-thicket-97709.herokuapp.com request_id=bc0fd458-0a88-4f7f-8fe6-7a21d52e3035 fwd="114.31.4.178" dyno= connect= service= status=503 bytes= protocol=https
2021-10-12T08:16:15.988690+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gentle-thicket-97709.herokuapp.com request_id=b830f6e2-5525-4310-b415-4e902015b8e3 fwd="114.31.4.178" dyno= connect= service= status=503 bytes= protocol=https
Heroku have very low nodejs version and you can't update it sadly, so there is no real way to fix it. You still can run a bot here if it works on djs v12.5.3
You can specify a node version in the package.json with the engines property when using heroku. Can you try setting the version to 15 or higher?
{
"name": "myapp",
"description": "a really cool app",
"version": "1.0.0",
"engines": {
"node": "15.x"
}
}
I tried to publish my app to Heroku but I got the below error message:
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail
I checked the logs and got the below info which I cannot decipher:
(node:40446) SyntaxError Plugin: heroku: /home/me/.local/share/heroku/config.json: Unexpected end of JSON input
module: #oclif/config#1.17.0
task: runHook prerun
plugin: heroku
root: /snap/heroku/4076
See more details with DEBUG=*
2021-09-20T22:05:15.905073+00:00 app[api]: Deploy 17474356 by user me.me#myemail.com
2021-09-20T22:05:15.922889+00:00 app[api]: Scaled to web#1:Free by user me.me#myemail.com
2021-09-20T22:05:17.000000+00:00 app[api]: Build succeeded
2021-09-20T22:05:22.406972+00:00 heroku[web.1]: Starting process with command `npm start`
2021-09-20T22:05:23.782304+00:00 app[web.1]:
2021-09-20T22:05:23.782323+00:00 app[web.1]: > contact-keeper#1.0.0 start /app
2021-09-20T22:05:23.782323+00:00 app[web.1]: > node server.js
2021-09-20T22:05:23.782323+00:00 app[web.1]:
2021-09-20T22:05:24.264339+00:00 app[web.1]: /app/server.js:4
2021-09-20T22:05:24.264356+00:00 app[web.1]: const path = requier("path");
2021-09-20T22:05:24.264357+00:00 app[web.1]: ^
2021-09-20T22:05:24.264357+00:00 app[web.1]:
2021-09-20T22:05:24.264358+00:00 app[web.1]: ReferenceError: requier is not defined
2021-09-20T22:05:24.264358+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:14)
2021-09-20T22:05:24.264359+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1072:14)
2021-09-20T22:05:24.264359+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
2021-09-20T22:05:24.264360+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:937:32)
2021-09-20T22:05:24.264360+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:778:12)
2021-09-20T22:05:24.264360+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
2021-09-20T22:05:24.264361+00:00 app[web.1]: at internal/main/run_main_module.js:17:47
2021-09-20T22:05:24.276266+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-09-20T22:05:24.276629+00:00 app[web.1]: npm ERR! errno 1
2021-09-20T22:05:24.285403+00:00 app[web.1]: npm ERR! contact-keeper#1.0.0 start: `node server.js`
2021-09-20T22:05:24.285546+00:00 app[web.1]: npm ERR! Exit status 1
2021-09-20T22:05:24.285701+00:00 app[web.1]: npm ERR!
2021-09-20T22:05:24.285813+00:00 app[web.1]: npm ERR! Failed at the contact-keeper#1.0.0 start script.
2021-09-20T22:05:24.285905+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-09-20T22:05:24.304319+00:00 app[web.1]:
2021-09-20T22:05:24.307416+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-09-20T22:05:24.307459+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-09-20T22_05_24_286Z-debug.log
2021-09-20T22:05:24.477472+00:00 heroku[web.1]: Process exited with status 1
2021-09-20T22:05:24.608841+00:00 heroku[web.1]: State changed from starting to crashed
2021-09-20T22:05:24.616776+00:00 heroku[web.1]: State changed from crashed to starting
2021-09-20T22:05:30.615650+00:00 heroku[web.1]: Starting process with command `npm start`
2021-09-20T22:05:32.154416+00:00 app[web.1]:
2021-09-20T22:05:32.154432+00:00 app[web.1]: > contact-keeper#1.0.0 start /app
2021-09-20T22:05:32.154432+00:00 app[web.1]: > node server.js
2021-09-20T22:05:32.154433+00:00 app[web.1]:
2021-09-20T22:05:32.491951+00:00 app[web.1]: /app/server.js:4
2021-09-20T22:05:32.491970+00:00 app[web.1]: const path = requier("path");
2021-09-20T22:05:32.491970+00:00 app[web.1]: ^
2021-09-20T22:05:32.491970+00:00 app[web.1]:
2021-09-20T22:05:32.491971+00:00 app[web.1]: ReferenceError: requier is not defined
2021-09-20T22:05:32.491971+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:14)
2021-09-20T22:05:32.491971+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1072:14)
2021-09-20T22:05:32.491972+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
2021-09-20T22:05:32.491972+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:937:32)
2021-09-20T22:05:32.491972+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:778:12)
2021-09-20T22:05:32.491975+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
2021-09-20T22:05:32.491975+00:00 app[web.1]: at internal/main/run_main_module.js:17:47
2021-09-20T22:05:32.502469+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-09-20T22:05:32.504151+00:00 app[web.1]: npm ERR! errno 1
2021-09-20T22:05:32.507359+00:00 app[web.1]: npm ERR! contact-keeper#1.0.0 start: `node server.js`
2021-09-20T22:05:32.507361+00:00 app[web.1]: npm ERR! Exit status 1
2021-09-20T22:05:32.507362+00:00 app[web.1]: npm ERR!
2021-09-20T22:05:32.507362+00:00 app[web.1]: npm ERR! Failed at the contact-keeper#1.0.0 start script.
2021-09-20T22:05:32.507363+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-09-20T22:05:32.517624+00:00 app[web.1]:
2021-09-20T22:05:32.517629+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-09-20T22:05:32.517630+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-09-20T22_05_32_508Z-debug.log
2021-09-20T22:05:32.654009+00:00 heroku[web.1]: Process exited with status 1
2021-09-20T22:05:32.790052+00:00 heroku[web.1]: State changed from starting to crashed
2021-09-20T22:10:11.627061+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pure-thicket-06601.herokuapp.com request_id=0c6e85f7-f539-406d-a7fa-9d92a88ea7de fwd="89.211.153.133" dyno= connect= service= status=503 bytes= protocol=https
2021-09-20T22:10:12.524329+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=pure-thicket-06601.herokuapp.com request_id=c9282c5e-54aa-4735-802d-fd782041837a fwd="89.211.153.133" dyno= connect= service= status=503 bytes= protocol=https
2021-09-20T22:13:28.000000+00:00 app[api]: Build started by user me.me#myemail.com
2021-09-20T22:15:44.820687+00:00 app[api]: Deploy d8ef6129 by user me.me#myemail.com
2021-09-20T22:15:44.820687+00:00 app[api]: Release v4 created by user me.me#myemail.com
2021-09-20T22:15:45.198887+00:00 heroku[web.1]: State changed from crashed to starting
2021-09-20T22:15:46.000000+00:00 app[api]: Build succeeded
2021-09-20T22:15:51.404944+00:00 heroku[web.1]: Starting process with command `npm start`
2021-09-20T22:15:52.687305+00:00 app[web.1]:
2021-09-20T22:15:52.687323+00:00 app[web.1]: > contact-keeper#1.0.0 start /app
2021-09-20T22:15:52.687323+00:00 app[web.1]: > node server.js
2021-09-20T22:15:52.687324+00:00 app[web.1]:
2021-09-20T22:15:53.120246+00:00 app[web.1]: /app/server.js:4
2021-09-20T22:15:53.120260+00:00 app[web.1]: const path = requier("path");
2021-09-20T22:15:53.120260+00:00 app[web.1]: ^
2021-09-20T22:15:53.120261+00:00 app[web.1]:
2021-09-20T22:15:53.120262+00:00 app[web.1]: ReferenceError: requier is not defined
2021-09-20T22:15:53.120262+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:4:14)
2021-09-20T22:15:53.120263+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1072:14)
2021-09-20T22:15:53.120263+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
2021-09-20T22:15:53.120264+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:937:32)
2021-09-20T22:15:53.120264+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:778:12)
2021-09-20T22:15:53.120265+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
2021-09-20T22:15:53.120265+00:00 app[web.1]: at internal/main/run_main_module.js:17:47
2021-09-20T22:15:53.132041+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-09-20T22:15:53.132277+00:00 app[web.1]: npm ERR! errno 1
2021-09-20T22:15:53.143479+00:00 app[web.1]: npm ERR! contact-keeper#1.0.0 start: `node server.js`
2021-09-20T22:15:53.143539+00:00 app[web.1]: npm ERR! Exit status 1
2021-09-20T22:15:53.143612+00:00 app[web.1]: npm ERR!
2021-09-20T22:15:53.143669+00:00 app[web.1]: npm ERR! Failed at the contact-keeper#1.0.0 start script.
2021-09-20T22:15:53.143714+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-09-20T22:15:53.156377+00:00 app[web.1]:
2021-09-20T22:15:53.156477+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-09-20T22:15:53.156529+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-09-20T22_15_53_144Z-debug.log
2021-09-20T22:15:53.320983+00:00 heroku[web.1]: Process exited with status 1
2021-09-20T22:15:53.393003+00:00 heroku[web.1]: State changed from starting to crashed
2021-09-20T22:16:11.040791+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pure-thicket-06601.herokuapp.com request_id=fcca437f-5d66-44db-a8dc-8bb638db78ac fwd="89.211.153.133" dyno= connect= service= status=503 bytes= protocol=https
2021-09-20T22:16:11.928866+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=pure-thicket-06601.herokuapp.com request_id=d12c938a-0a91-4947-8d10-6af6f31a7b9f fwd="89.211.153.133" dyno= connect= service= status=503 bytes= protocol=https
2021-09-20T22:17:36.704916+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=pure-thicket-06601.herokuapp.com request_id=5ed37742-5272-486e-b762-323e16c53cf1 fwd="89.211.153.133" dyno= connect= service= status=503 bytes= protocol=https
Any idea what went wrong? Everything worked perfectly fine in localhost but now even locally I'm having problems after deployment.
There is a spelling error. Replace
const path = requier("path");
with
const path = require("path");
and deploy it again to see if it works.
I finished working on my website, and everything works great locally, but I get an error when deploying to heroku.
Some background:
Back-end server was built using this tutorial (Express.js + Sequelize + PostgreSQL): https://www.djamware.com/post/5b56a6cc80aca707dd4f65a9/nodejs-expressjs-sequelizejs-and-postgresql-restful-api
Front-end was built by using npx create-react-app command.
Deploying issue
Now, for deploying I used the tutorial at https://www.freecodecamp.org/news/deploy-a-react-node-app-to/ and created a new Postgres Database on heroku (and that's it).
When I try to view the site at "xxxxx.herokuapp.com" this "Application error" message:
So i tried running the heroku logs --tail command and this was the message I got:
heroku logs --tail -a grades-il
2020-10-09T15:26:15.091358+00:00 heroku[web.1]: Starting process with command `npm start`
2020-10-09T15:26:17.586004+00:00 heroku[web.1]: Process exited with status 1
2020-10-09T15:26:17.623057+00:00 heroku[web.1]: State changed from starting to crashed
2020-10-09T15:26:17.333545+00:00 app[web.1]:
2020-10-09T15:26:17.333566+00:00 app[web.1]: > node-sequelize#0.0.0 start /app
2020-10-09T15:26:17.333567+00:00 app[web.1]: > node ./bin/www
2020-10-09T15:26:17.333567+00:00 app[web.1]:
2020-10-09T15:26:17.505070+00:00 app[web.1]: internal/modules/cjs/loader.js:834
2020-10-09T15:26:17.505072+00:00 app[web.1]: throw err;
2020-10-09T15:26:17.505072+00:00 app[web.1]: ^
2020-10-09T15:26:17.505072+00:00 app[web.1]:
2020-10-09T15:26:17.505073+00:00 app[web.1]: Error: Cannot find module './school'
2020-10-09T15:26:17.505073+00:00 app[web.1]: Require stack:
2020-10-09T15:26:17.505073+00:00 app[web.1]: - /app/controllers/index.js
2020-10-09T15:26:17.505074+00:00 app[web.1]: - /app/routes/index.js
2020-10-09T15:26:17.505074+00:00 app[web.1]: - /app/app.js
2020-10-09T15:26:17.505074+00:00 app[web.1]: - /app/bin/www
2020-10-09T15:26:17.505075+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
2020-10-09T15:26:17.505075+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:687:27)
2020-10-09T15:26:17.505075+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:903:19)
2020-10-09T15:26:17.505075+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
2020-10-09T15:26:17.505076+00:00 app[web.1]: at Object.<anonymous> (/app/controllers/index.js:1:16)
2020-10-09T15:26:17.505076+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1015:30)
2020-10-09T15:26:17.505076+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
2020-10-09T15:26:17.505076+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:879:32)
2020-10-09T15:26:17.505077+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:724:14)
2020-10-09T15:26:17.505077+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:903:19) {
2020-10-09T15:26:17.505077+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2020-10-09T15:26:17.505077+00:00 app[web.1]: requireStack: [
2020-10-09T15:26:17.505078+00:00 app[web.1]: '/app/controllers/index.js',
2020-10-09T15:26:17.505078+00:00 app[web.1]: '/app/routes/index.js',
2020-10-09T15:26:17.505078+00:00 app[web.1]: '/app/app.js',
2020-10-09T15:26:17.505079+00:00 app[web.1]: '/app/bin/www'
2020-10-09T15:26:17.505079+00:00 app[web.1]: ]
2020-10-09T15:26:17.505079+00:00 app[web.1]: }
2020-10-09T15:26:17.515720+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-10-09T15:26:17.515920+00:00 app[web.1]: npm ERR! errno 1
2020-10-09T15:26:17.520600+00:00 app[web.1]: npm ERR! node-sequelize#0.0.0 start: `node ./bin/www`
2020-10-09T15:26:17.520705+00:00 app[web.1]: npm ERR! Exit status 1
2020-10-09T15:26:17.520815+00:00 app[web.1]: npm ERR!
2020-10-09T15:26:17.520929+00:00 app[web.1]: npm ERR! Failed at the node-sequelize#0.0.0 start script.
2020-10-09T15:26:17.521011+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-10-09T15:26:17.525367+00:00 app[web.1]:
2020-10-09T15:26:17.525509+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-10-09T15:26:17.525583+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-10-09T15_26_17_521Z-debug.log
2020-10-09T15:27:20.340920+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=xxxxx.herokuapp.com request_id=320b7a37-e1e9-4974-92b0-b98e6af2667a fwd="79.177.39.29" dyno= connect= service= status=503 bytes= protocol=http
2020-10-09T15:27:20.850485+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=xxxxx.herokuapp.com request_id=23268c05-28cf-4fc4-9aa7-8ef69befa2b2 fwd="79.177.39.29" dyno= connect= service= status=503 bytes= protocol=http
So if you have any idea how to fix this, I'd appreciate your help.
Thanks!
Thanks to Mohit Karekar I solved the problem by just changing
require('./school');
to
require('./School');
and that's it.
On reading the logs it seems as if there is a problem in google OAuth because its callback URL is localhost:3000. So I am not unable to fix it.
These are the heroku logs
2020-08-06T18:58:51.639489+00:00 heroku[web.1]: Starting process with command `npm start`2020-08-06T18:58:55.667318+00:00 app[web.1]:
2020-08-06T18:58:55.667346+00:00 app[web.1]: > secrets#1.0.0 start /app
2020-08-06T18:58:55.667346+00:00 app[web.1]: > node index.js
2020-08-06T18:58:55.667347+00:00 app[web.1]:
2020-08-06T18:58:56.738632+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2020-08-06T18:58:56.738668+00:00 app[web.1]: designed for a production environment, as it will leak
2020-08-06T18:58:56.738669+00:00 app[web.1]: memory, and will not scale past a single process.
2020-08-06T18:58:56.785355+00:00 app[web.1]: /app/node_modules/passport-oauth2/lib/strategy.js:86
2020-08-06T18:58:56.785357+00:00 app[web.1]: if (!options.clientID) { throw new TypeError('OAuth2Strategy requires a clientID option'); }
2020-08-06T18:58:56.785358+00:00 app[web.1]: ^
2020-08-06T18:58:56.785359+00:00 app[web.1]:
2020-08-06T18:58:56.785359+00:00 app[web.1]: TypeError: OAuth2Strategy requires a clientID option
2020-08-06T18:58:56.785360+00:00 app[web.1]: at Strategy.OAuth2Strategy (/app/node_modules/passport-oauth2/lib/strategy.js:86:34)
2020-08-06T18:58:56.785360+00:00 app[web.1]: at new Strategy (/app/node_modules/passport-google-oauth20/lib/strategy.js:52:18)
2020-08-06T18:58:56.785361+00:00 app[web.1]: at Object.<anonymous> (/app/index.js:65:3)
2020-08-06T18:58:56.785361+00:00 app[web.1]: at Module._compile (module.js:570:32)
2020-08-06T18:58:56.785362+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10)
2020-08-06T18:58:56.785362+00:00 app[web.1]: at Module.load (module.js:487:32)
2020-08-06T18:58:56.785362+00:00 app[web.1]: at tryModuleLoad (module.js:446:12)
2020-08-06T18:58:56.785363+00:00 app[web.1]: at Function.Module._load (module.js:438:3)
2020-08-06T18:58:56.785363+00:00 app[web.1]: at Module.runMain (module.js:604:10)
2020-08-06T18:58:56.785363+00:00 app[web.1]: at run (bootstrap_node.js:389:7)
2020-08-06T18:58:56.785364+00:00 app[web.1]: at startup (bootstrap_node.js:149:9)
2020-08-06T18:58:56.785364+00:00 app[web.1]: at bootstrap_node.js:504:3
2020-08-06T18:58:56.796796+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-06T18:58:56.797619+00:00 app[web.1]: npm ERR! errno 1
2020-08-06T18:58:56.799572+00:00 app[web.1]: npm ERR! secrets#1.0.0 start: `node index.js`
2020-08-06T18:58:56.799846+00:00 app[web.1]: npm ERR! Exit status 1
2020-08-06T18:58:56.800246+00:00 app[web.1]: npm ERR!
2020-08-06T18:58:56.800511+00:00 app[web.1]: npm ERR! Failed at the secrets#1.0.0 start script.
2020-08-06T18:58:56.800815+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-06T18:58:56.816356+00:00 app[web.1]:
2020-08-06T18:58:56.816594+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-06T18:58:56.816734+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-08-06T18_58_56_803Z-debug.log
2020-08-06T18:58:56.882429+00:00 heroku[web.1]: Process exited with status 1
2020-08-06T18:58:56.923979+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-06T18:58:56.930118+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-06T18:59:00.529632+00:00 heroku[web.1]: Starting process with command `npm start`2020-08-06T18:59:02.858493+00:00 app[web.1]:
2020-08-06T18:59:02.858511+00:00 app[web.1]: > secrets#1.0.0 start /app
2020-08-06T18:59:02.858512+00:00 app[web.1]: > node index.js
2020-08-06T18:59:02.858512+00:00 app[web.1]:
2020-08-06T18:59:03.775308+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2020-08-06T18:59:03.775334+00:00 app[web.1]: designed for a production environment, as it will leak
2020-08-06T18:59:03.775335+00:00 app[web.1]: memory, and will not scale past a single process.
2020-08-06T18:59:03.811896+00:00 app[web.1]: /app/node_modules/passport-oauth2/lib/strategy.js:86
2020-08-06T18:59:03.811898+00:00 app[web.1]: if (!options.clientID) { throw new TypeError('OAuth2Strategy requires a clientID option'); }
2020-08-06T18:59:03.811898+00:00 app[web.1]: ^
2020-08-06T18:59:03.811899+00:00 app[web.1]:
2020-08-06T18:59:03.811900+00:00 app[web.1]: TypeError: OAuth2Strategy requires a clientID option
2020-08-06T18:59:03.811900+00:00 app[web.1]: at Strategy.OAuth2Strategy (/app/node_modules/passport-oauth2/lib/strategy.js:86:34)
2020-08-06T18:59:03.811900+00:00 app[web.1]: at new Strategy (/app/node_modules/passport-google-oauth20/lib/strategy.js:52:18)
2020-08-06T18:59:03.811901+00:00 app[web.1]: at Object.<anonymous> (/app/index.js:65:3)
2020-08-06T18:59:03.811901+00:00 app[web.1]: at Module._compile (module.js:570:32)
2020-08-06T18:59:03.811902+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10)
2020-08-06T18:59:03.811902+00:00 app[web.1]: at Module.load (module.js:487:32)
2020-08-06T18:59:03.811902+00:00 app[web.1]: at tryModuleLoad (module.js:446:12)
2020-08-06T18:59:03.811903+00:00 app[web.1]: at Function.Module._load (module.js:438:3)
2020-08-06T18:59:03.811907+00:00 app[web.1]: at Module.runMain (module.js:604:10)
2020-08-06T18:59:03.811907+00:00 app[web.1]: at run (bootstrap_node.js:389:7)
2020-08-06T18:59:03.811908+00:00 app[web.1]: at startup (bootstrap_node.js:149:9)
2020-08-06T18:59:03.811908+00:00 app[web.1]: at bootstrap_node.js:504:3
2020-08-06T18:59:03.822926+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-08-06T18:59:03.823477+00:00 app[web.1]: npm ERR! errno 1
2020-08-06T18:59:03.824880+00:00 app[web.1]: npm ERR! secrets#1.0.0 start: `node index.js`
2020-08-06T18:59:03.825035+00:00 app[web.1]: npm ERR! Exit status 1
2020-08-06T18:59:03.825267+00:00 app[web.1]: npm ERR!
2020-08-06T18:59:03.825456+00:00 app[web.1]: npm ERR! Failed at the secrets#1.0.0 start script.
2020-08-06T18:59:03.825605+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-08-06T18:59:03.832579+00:00 app[web.1]:
2020-08-06T18:59:03.832838+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-08-06T18:59:03.832980+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-08-06T18_59_03_827Z-debug.log
2020-08-06T18:59:03.902827+00:00 heroku[web.1]: Process exited with status 1
2020-08-06T18:59:03.944349+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-06T18:59:07.879891+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=secret-anonymous.herokuapp.com request_id=ab5e9261-5105-4b89-bdd0-8f14e9397084 fwd="110.225.83.237" dyno= connect= service= status=503 bytes= protocol=https2020-08-06T18:59:08.552527+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=secret-anonymous.herokuapp.com request_id=fa83f921-6670-4182-8f21-7a9401f92e65 fwd="110.225.83.237" dyno= connect= service= status=503 bytes= protocol=https
Not able to figure out the problem. But the app runs perfectly fine on localhost:3000
And this is the link to github repo:- https://github.com/Naman-2001/Secrets
put all of your secret/sensitive keys (clientID, clientSecret, etc...) in Heroku config vars so you can access it in your code like process.env.['YOUR SECRET PROPERTY']
Read more about Heroku Configuration and Config Vars
I have a chatbot made using Node Js. It uses "googleapis". It works fine when I create a server from my laptop. But I uploaded files to github and used heroku as server. I get "Application Error" on the web address provided by heroku to access the app. How to fix it.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
2019-11-20T07:55:39.730004+00:00 app[web.1]:
internal/modules/cjs/loader.js:800 2019-11-20T07:55:39.730026+00:00
app[web.1]: throw err; 2019-11-20T07:55:39.730028+00:00 app[web.1]: ^
2019-11-20T07:55:39.730030+00:00 app[web.1]:
2019-11-20T07:55:39.730032+00:00 app[web.1]: Error: Cannot find module
'googleapis' 2019-11-20T07:55:39.730034+00:00 app[web.1]: Require
stack: 2019-11-20T07:55:39.730036+00:00 app[web.1]: - /app/app.js
2019-11-20T07:55:39.730045+00:00 app[web.1]: at
Function.Module._resolveFilename
(internal/modules/cjs/loader.js:797:15)
2019-11-20T07:55:39.730047+00:00 app[web.1]: at Function.Module._load
(internal/modules/cjs/loader.js:690:27)
2019-11-20T07:55:39.730050+00:00 app[web.1]: at Module.require
(internal/modules/cjs/loader.js:852:19)
2019-11-20T07:55:39.730052+00:00 app[web.1]: at require
(internal/modules/cjs/helpers.js:74:18)
2019-11-20T07:55:39.730053+00:00 app[web.1]: at Object.
(/app/app.js:23:16) 2019-11-20T07:55:39.730055+00:00 app[web.1]: at
Module._compile (internal/modules/cjs/loader.js:959:30)
2019-11-20T07:55:39.730057+00:00 app[web.1]: at
Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
2019-11-20T07:55:39.730059+00:00 app[web.1]: at Module.load
(internal/modules/cjs/loader.js:815:32)
2019-11-20T07:55:39.730061+00:00 app[web.1]: at Function.Module._load
(internal/modules/cjs/loader.js:727:14)
2019-11-20T07:55:39.730063+00:00 app[web.1]: at
Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
2019-11-20T07:55:39.730065+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2019-11-20T07:55:39.730067+00:00 app[web.1]: requireStack: [
'/app/app.js' ] 2019-11-20T07:55:39.730069+00:00 app[web.1]: }
2019-11-20T07:55:39.737402+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-11-20T07:55:39.737824+00:00 app[web.1]: npm ERR! errno 1
2019-11-20T07:55:39.739094+00:00 app[web.1]: npm ERR!
messenger-get-started#1.0.0 start: node app.js
2019-11-20T07:55:39.739328+00:00 app[web.1]: npm ERR! Exit status 1
2019-11-20T07:55:39.739554+00:00 app[web.1]: npm ERR!
2019-11-20T07:55:39.739763+00:00 app[web.1]: npm ERR! Failed at the
messenger-get-started#1.0.0 start script.
2019-11-20T07:55:39.739994+00:00 app[web.1]: npm ERR! This is probably
not a problem with npm. There is likely additional logging output
above. 2019-11-20T07:55:39.747500+00:00 app[web.1]:
2019-11-20T07:55:39.747681+00:00 app[web.1]: npm ERR! A complete log
of this run can be found in: 2019-11-20T07:55:39.747852+00:00
app[web.1]: npm ERR!
/app/.npm/_logs/2019-11-20T07_55_39_740Z-debug.log
2019-11-20T07:55:39.842413+00:00 heroku[web.1]: State changed from
starting to crashed 2019-11-20T07:55:39.831194+00:00 heroku[web.1]:
Process exited with status 1 2019-11-20T08:47:20.684024+00:00
heroku[router]: at=error code=H10 desc="App crashed" method=GET
path="/" host=mukupukuu.herokuapp.com
request_id=9bf7f838-97ee-4776-9517-b9c0b530241d fwd="49.244.16.204"
dyno= connect= service= status=503 bytes= protocol=https
2019-11-20T08:47:32.344155+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/favicon.ico"
host=mukupukuu.herokuapp.com
request_id=ace83680-39e1-489d-a50c-b1c6811f24ce fwd="49.244.16.204"
dyno= connect= service= status=503 bytes= protocol=https
Make sure to include the GoogleApi npm package in the package.json This helps Heroku fetch and install the required dependencies on the server where your application is deployed.
You can add the package and version manually to package.json
OR
A better alternative is to run npm install --save googleapis