this is my first project in node js and it worked perfect on localhost but when i deployed it on heroku it's not working and shows application error,, i couldn't figure out what is the problem and below is my heroku logs and server.js code.
can someone please help me solve this?
thanks in advance
const express = require('express');
const morgan = require('morgan');
const mongoose = require('mongoose');
const dotenv = require('dotenv');
const jwt = require('jsonwebtoken');
const http = require('http');
const multer = require("multer");
const app = express();
const server = http.createServer(app);
// corsfffffffff
/************************************** Socket IO Related Start ************************************************/
// config dotenv
dotenv.config();
const dbURI = process.env.MONGO_URL || "mongodb+srv://user:cvcvcv00S-#cluster0.jpij0.mongodb.net/myFirstDatabase?retryWrites=true&w=majority";
mongoose.connect(dbURI, { useNewUrlParser: true, useUnifiedTopology: true })
.then(result => server.listen(process.env.PORT || 3000) )
.catch(err => console.log(err));
app.set('view engine', 'ejs');
app.use(express.json);
// app.use(express.urlencoded({ extended: true }));
// app.use(morgan("dev"));
app.use((req, res, next) => {
res.locals.path = req.path;
next();
});
const subscribersRouter = require('./routes/subscribers')
app.use('/subscribers', subscribersRouter)
app.get("/", function(req,res){
res.send("welcome to app");
})
heroku logs:
2021-12-09T19:50:00.133986+00:00 app[web.1]:
2021-12-09T19:50:00.134003+00:00 app[web.1]: > api-master-nodejs#1.0.0 start /app
2021-12-09T19:50:00.134003+00:00 app[web.1]: > node app.js
2021-12-09T19:50:00.134003+00:00 app[web.1]:
2021-12-09T19:50:01.187253+00:00 heroku[web.1]: State changed from starting to up
2021-12-09T19:50:32.260199+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=obscure-waters-05043.herokuapp.com request_id=cfbf2688-d4d4-4b7a-adf0-2663a1d7dace fwd="85.108.198.36" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https
2021-12-09T19:50:43.082048+00:00 heroku[web.1]: Restarting
2021-12-09T19:50:43.107251+00:00 heroku[web.1]: State changed from up to starting
2021-12-09T19:50:43.871385+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-12-09T19:50:44.069113+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/favicon.ico" host=obscure-waters-05043.herokuapp.com request_id=49445fee-a0d0-4199-9adb-bf4314016e98 fwd="85.108.198.36" dyno=web.1 connect=0ms service=11418ms status=503 bytes=0 protocol=https
2021-12-09T19:50:44.193647+00:00 heroku[web.1]: Process exited with status 143
2021-12-09T19:50:45.155711+00:00 heroku[web.1]: Starting process with command `npm start`
2021-12-09T19:50:46.561346+00:00 app[web.1]:
2021-12-09T19:50:46.561360+00:00 app[web.1]: > api-master-nodejs#1.0.0 start /app
2021-12-09T19:50:46.561361+00:00 app[web.1]: > node app.js
2021-12-09T19:50:46.561361+00:00 app[web.1]:
2021-12-09T19:50:47.295414+00:00 heroku[web.1]: State changed from starting to up
2021-12-09T19:51:51.000000+00:00 app[api]: Build started by user sebaalchalabi#gmail.com
2021-12-09T19:52:08.296910+00:00 app[api]: Deploy 202801b6 by user sebaalchalabi#gmail.com
2021-12-09T19:52:08.296910+00:00 app[api]: Release v44 created by user sebaalchalabi#gmail.com
2021-12-09T19:52:08.590301+00:00 heroku[web.1]: Restarting
2021-12-09T19:52:08.615504+00:00 heroku[web.1]: State changed from up to starting
2021-12-09T19:52:09.000000+00:00 app[api]: Build succeeded
2021-12-09T19:52:09.331866+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-12-09T19:52:09.574745+00:00 heroku[web.1]: Process exited with status 143
2021-12-09T19:52:10.680588+00:00 heroku[web.1]: Starting process with command `npm start`
2021-12-09T19:52:11.875404+00:00 app[web.1]:
2021-12-09T19:52:11.875420+00:00 app[web.1]: > api-master-nodejs#1.0.0 start /app
2021-12-09T19:52:11.875420+00:00 app[web.1]: > node app.js
2021-12-09T19:52:11.875420+00:00 app[web.1]:
2021-12-09T19:52:12.491955+00:00 heroku[web.1]: State changed from starting to up
2021-12-09T19:53:21.013488+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=obscure-waters-05043.herokuapp.com request_id=3d66d37c-eec6-44d2-8792-a7ddff579766 fwd="85.108.198.36" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https
2021-12-09T19:53:41.188552+00:00 heroku[web.1]: Restarting
2021-12-09T19:53:41.191420+00:00 heroku[web.1]: State changed from up to starting
2021-12-09T19:53:41.978236+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-12-09T19:53:42.180105+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/favicon.ico" host=obscure-waters-05043.herokuapp.com request_id=98bb6ae6-b3ec-4206-95a4-6279e7aff78b fwd="85.108.198.36" dyno=web.1 connect=0ms service=20953ms status=503 bytes=0 protocol=https
2021-12-09T19:53:42.314257+00:00 heroku[web.1]: Process exited with status 143
2021-12-09T19:53:43.672529+00:00 heroku[web.1]: Starting process with command `npm start`
2021-12-09T19:53:45.699311+00:00 app[web.1]:
2021-12-09T19:53:45.699323+00:00 app[web.1]: > api-master-nodejs#1.0.0 start /app
2021-12-09T19:53:45.699324+00:00 app[web.1]: > node app.js
2021-12-09T19:53:45.699324+00:00 app[web.1]:
2021-12-09T19:53:47.034852+00:00 heroku[web.1]: State changed from starting to up
2021-12-09T19:57:01.713660+00:00 heroku[web.1]: Restarting
2021-12-09T19:57:01.847677+00:00 heroku[web.1]: State changed from up to starting
2021-12-09T19:57:02.852486+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-12-09T19:57:03.172988+00:00 heroku[web.1]: Process exited with status 143
2021-12-09T19:57:04.132727+00:00 heroku[web.1]: Starting process with command `npm start`
2021-12-09T19:57:05.215604+00:00 app[web.1]:
2021-12-09T19:57:05.215618+00:00 app[web.1]: > api-master-nodejs#1.0.0 start /app
2021-12-09T19:57:05.215618+00:00 app[web.1]: > node app.js
2021-12-09T19:57:05.215618+00:00 app[web.1]:
2021-12-09T19:57:05.821299+00:00 heroku[web.1]: State changed from starting to up
2021-12-09T19:57:15.000000+00:00 app[api]: Build started by user sebaalchalabi#gmail.com
2021-12-09T19:57:30.843649+00:00 app[api]: Release v45 created by user sebaalchalabi#gmail.com
2021-12-09T19:57:30.843649+00:00 app[api]: Deploy 338ae6f5 by user sebaalchalabi#gmail.com
2021-12-09T19:57:31.000000+00:00 app[api]: Build succeeded
2021-12-09T19:57:31.085978+00:00 heroku[web.1]: Restarting
2021-12-09T19:57:31.201283+00:00 heroku[web.1]: State changed from up to starting
2021-12-09T19:57:31.880715+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-12-09T19:57:32.065101+00:00 heroku[web.1]: Process exited with status 143
2021-12-09T19:57:33.428958+00:00 heroku[web.1]: Starting process with command `npm start`
2021-12-09T19:57:34.677151+00:00 app[web.1]:
2021-12-09T19:57:34.677180+00:00 app[web.1]: > api-master-nodejs#1.0.0 start /app
2021-12-09T19:57:34.677181+00:00 app[web.1]: > node app.js
2021-12-09T19:57:34.677181+00:00 app[web.1]:
2021-12-09T19:57:35.761777+00:00 heroku[web.1]: State changed from starting to up
2021-12-09T19:58:08.215698+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=obscure-waters-05043.herokuapp.com request_id=51f7029d-58a6-445a-a111-a77bccfa90c0 fwd="85.108.198.36" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2021-12-09T19:58:38.614677+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/favicon.ico" host=obscure-waters-05043.herokuapp.com request_id=56500d70-9535-4cdf-8665-2cfe463b908d fwd="85.108.198.36" dyno=web.1 connect=0ms service=30002ms status=503 bytes=0 protocol=https
2021-12-09T20:05:25.879914+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=obscure-waters-05043.herokuapp.com request_id=e7ff010a-b9b7-49e8-bae6-b72eb0794c0e fwd="34.204.52.120" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=http
2021-12-09T20:07:18.000000+00:00 app[api]: Build started by user sebaalchalabi#gmail.com
2021-12-09T20:07:34.550502+00:00 app[api]: Release v46 created by user sebaalchalabi#gmail.com
2021-12-09T20:07:34.550502+00:00 app[api]: Deploy 274eee09 by user sebaalchalabi#gmail.com
2021-12-09T20:07:35.000000+00:00 app[api]: Build succeeded
2021-12-09T20:07:38.124510+00:00 heroku[web.1]: Restarting
2021-12-09T20:07:38.227065+00:00 heroku[web.1]: State changed from up to starting
2021-12-09T20:07:39.027871+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-12-09T20:07:39.245964+00:00 heroku[web.1]: Process exited with status 143
2021-12-09T20:07:40.890971+00:00 heroku[web.1]: Starting process with command `npm start`
2021-12-09T20:07:42.140238+00:00 app[web.1]:
2021-12-09T20:07:42.140265+00:00 app[web.1]: > api-master-nodejs#1.0.0 start /app
2021-12-09T20:07:42.140265+00:00 app[web.1]: > node app.js
2021-12-09T20:07:42.140266+00:00 app[web.1]:
2021-12-09T20:07:43.221265+00:00 heroku[web.1]: State changed from starting to up
2021-12-09T20:08:14.814637+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=obscure-waters-05043.herokuapp.com request_id=afc72089-87b7-4d01-a2dd-a0efddfc3d62 fwd="85.108.198.36" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2021-12-09T20:08:45.157453+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/favicon.ico" host=obscure-waters-05043.herokuapp.com request_id=b38528cf-d42d-4184-b52b-6808444e99bd fwd="85.108.198.36" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2021-12-09T20:13:59.000000+00:00 app[api]: Build started by user sebaalchalabi#gmail.com
2021-12-09T20:14:15.262368+00:00 app[api]: Deploy fe24fd44 by user sebaalchalabi#gmail.com
2021-12-09T20:14:15.262368+00:00 app[api]: Release v47 created by user sebaalchalabi#gmail.com
2021-12-09T20:14:15.498236+00:00 heroku[web.1]: Restarting
2021-12-09T20:14:15.523576+00:00 heroku[web.1]: State changed from up to starting
2021-12-09T20:14:16.000000+00:00 app[api]: Build succeeded
2021-12-09T20:14:16.770111+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-12-09T20:14:17.043608+00:00 heroku[web.1]: Process exited with status 143
2021-12-09T20:14:17.959793+00:00 heroku[web.1]: Starting process with command `npm start`
2021-12-09T20:14:19.191029+00:00 app[web.1]:
2021-12-09T20:14:19.191041+00:00 app[web.1]: > api-master-nodejs#1.0.0 start /app
2021-12-09T20:14:19.191041+00:00 app[web.1]: > node app.js
2021-12-09T20:14:19.191042+00:00 app[web.1]:
2021-12-09T20:14:19.891841+00:00 heroku[web.1]: State changed from starting to up
Did you install all the modules using npm install --save <module>? If you don't include the --save option, then the module won't be written to your package.json file which Heroku uses to automatically download the dependencies.
Related
I am trying to deploy in heroku, but i am getting errors. Can somebody tell me where i did mistake.
I tried many things but didnt worked.
Here is the code for app.js
const express = require("express");
const bodyParser = require("body-parser");
const mongoose = require("mongoose");
const _ = require("lodash");
const app = express();
app.set('view engine', 'ejs');
app.use(bodyParser.urlencoded({extended: true}));
app.use(express.static("public"));
mongoose.connect("mongodb+srv://Teja-Sruthi:varanasi#cluster0.rp0nmhh.mongodb.net/toDoListDB",function(err){
if(err)
console.log("Here is the error");
else
console.log("Successfully connected to MongoDB");
});
const itemsSchema = new mongoose.Schema({
name:String
});
const listSchema ={
name:String,
items:[itemsSchema]
};
const Item = mongoose.model("Item",itemsSchema);
const List = mongoose.model("List",listSchema);
const item1 = new Item({
name: "Complete this course"
});
const item2 = new Item({
name: "Complete RPA course"
});
const item3 = new Item({
name: "Learn Programming"
});
const defaultArray = [item1, item2, item3];
// Item.insertMany(defaultArray,function(err){
// if(err)
// console.log(err);
// else
// console.log("Successfully saved");
// });
app.get("/", function(req, res) {
Item.find(function(err,item){
if(err)
console.log("Error in finding ");
else{
if(item.length==0){
Item.insertMany(defaultArray,function(err){
if(err)
console.log("Error in inserting ");
else
console.log("Successfully saved");
});
return res.redirect("/");
}
}
res.render("list", {listTitle: "Today", newListItems: item});
})
});
app.post("/", function(req, res){
const itemName = req.body.newItem;
const title = req.body.list;
if(itemName!=""){
const item = new Item({
name: itemName,
});
if(title=="Today"){
item.save();
res.redirect("/");
}else{
List.findOne({name:title},function(err,matched){
matched.items.push(item);
matched.save();
res.redirect("/"+title);
});
}
}
else{
res.redirect("/"+title);
}
});
app.post("/delete",function(req,res){
const itemId = req.body.checkbox;
const itemName = req.body.itemName;
if(itemName=="Today"){
Item.findByIdAndRemove(itemId,function(err){
if(err)
console.log("Error in deleting")
else{
res.redirect("/");
}
});
}else{
List.findOneAndUpdate({name:itemName},{$pull:{items:{_id:itemId}}},function(err,result){
if(!err){
res.redirect("/"+itemName);
}
else {
console.log("error is from here");
}
});
}
});
app.get("/:value",function(req,res){
let listVal = _.capitalize(req.params.value);
const list1 = new List({
name: listVal,
items :defaultArray
});
List.findOne({name:listVal},function(err,getList){
if(err)
console.log("Error in the list");
else{
if(!getList){
list1.save();
res.redirect("/"+listVal);
}
else{
res.render("list",{listTitle:listVal, newListItems:getList.items});
}
}
});
});
app.get("/about", function(req, res){
res.render("about");
});
const port = 3000;
const host = '0.0.0.0';
app.listen(process.env.PORT || 3000, host, function() {
console.log("Server started on port 3000");
});
Procfile
worker: node app.js
First I used web, later in some stackoverflow post they suggested to use worker. So, I used it.
This is package.json
{
"name": "todolist-v1",
"version": "1.0.0",
"main": "app.js",
"scripts": {
"start": "node app.js",
"dev": "nodemon app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"engines": {
"node": "16.17.0",
"npm": "8.15.0"
},
"dependencies": {
"body-parser": "^1.18.3",
"ejs": "^2.6.1",
"express": "^4.16.3",
"lodash": "^4.17.21",
"mongoose": "^6.6.1"
},
"description": ""
}
These are the logs i got in used heroku logs command
2022-09-22T11:43:47.573252+00:00 heroku[web.1]: Starting process with command `npm start`
2022-09-22T11:43:48.020566+00:00 heroku[worker.1]: Starting process with command `node app.js`
2022-09-22T11:43:48.636966+00:00 heroku[worker.1]: State changed from starting to up
2022-09-22T11:43:49.398088+00:00 app[web.1]:
2022-09-22T11:43:49.398103+00:00 app[web.1]: > todolist-v1#1.0.0 start
2022-09-22T11:43:49.398103+00:00 app[web.1]: > node app.js
2022-09-22T11:43:49.398103+00:00 app[web.1]:
2022-09-22T11:43:49.914670+00:00 app[web.1]: Server started on port 3000
2022-09-22T11:43:50.376696+00:00 app[worker.1]: Server started on port 3000
2022-09-22T11:43:50.490534+00:00 heroku[web.1]: State changed from starting to up
2022-09-22T11:44:19.939658+00:00 app[web.1]: Here is the error
2022-09-22T11:44:20.402283+00:00 app[worker.1]: Here is the error
2022-09-22T11:44:25.544171+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=dry-oasis-02543.herokuapp.com request_id=8f66c999-2443-4fc3-a235-ee19ab2e1e19 fwd="49.204.236.35" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https
2022-09-22T11:44:36.038694+00:00 app[web.1]: Error in the list
2022-09-22T11:44:56.021923+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/favicon.ico" host=dry-oasis-02543.herokuapp.com request_id=9aad3faf-e16b-4d72-9017-d5adab63dcdd fwd="49.204.236.35" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2022-09-22T11:49:05.000000+00:00 app[api]: Build started by user tejasruthivaranasi#gmail.com
2022-09-22T11:49:24.598076+00:00 app[api]: Deploy ccfe68fc by user tejasruthivaranasi#gmail.com
2022-09-22T11:49:24.598076+00:00 app[api]: Release v8 created by user tejasruthivaranasi#gmail.com
2022-09-22T11:49:25.191002+00:00 heroku[web.1]: Restarting
2022-09-22T11:49:25.206129+00:00 heroku[web.1]: State changed from up to starting
2022-09-22T11:49:25.241019+00:00 heroku[worker.1]: Restarting
2022-09-22T11:49:25.243739+00:00 heroku[worker.1]: State changed from up to starting
2022-09-22T11:49:25.931887+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2022-09-22T11:49:26.000000+00:00 app[api]: Build succeeded
2022-09-22T11:49:26.098641+00:00 heroku[web.1]: Process exited with status 143
2022-09-22T11:49:26.123725+00:00 heroku[worker.1]: Stopping all processes with SIGTERM
2022-09-22T11:49:26.312098+00:00 heroku[worker.1]: Process exited with status 143
2022-09-22T11:49:27.079784+00:00 heroku[web.1]: Starting process with command `npm start`
2022-09-22T11:49:27.344674+00:00 heroku[worker.1]: Starting process with command `node app.js`
2022-09-22T11:49:27.941719+00:00 heroku[worker.1]: State changed from starting to up
2022-09-22T11:49:28.759619+00:00 app[web.1]:
2022-09-22T11:49:28.759633+00:00 app[web.1]: > todolist-v1#1.0.0 start
2022-09-22T11:49:28.759633+00:00 app[web.1]: > node app.js
2022-09-22T11:49:28.759633+00:00 app[web.1]:
2022-09-22T11:49:29.100500+00:00 app[web.1]: Server started on port 3000
2022-09-22T11:49:29.242842+00:00 heroku[web.1]: State changed from starting to up
2022-09-22T11:49:29.509283+00:00 app[worker.1]: Server started on port 3000
2022-09-22T11:49:59.125117+00:00 app[web.1]: Here is the error
2022-09-22T11:49:59.539099+00:00 app[worker.1]: Here is the error
2022-09-22T11:50:01.519135+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=dry-oasis-02543.herokuapp.com request_id=b11dd120-7249-4193-900b-06e64dcb57a2 fwd="49.204.236.35" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2022-09-22T11:50:12.216527+00:00 app[web.1]: Error in the list
2022-09-22T11:50:32.201892+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/favicon.ico" host=dry-oasis-02543.herokuapp.com request_id=43ebca7f-343b-4ba7-b9af-b17f525b8211 fwd="49.204.236.35" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2022-09-22T11:51:25.684763+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=dry-oasis-02543.herokuapp.com request_id=1506f9ca-959b-464d-9452-6c012bc8f60e fwd="49.204.236.35" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https
2022-09-22T11:51:36.223978+00:00 app[web.1]: Error in the list
2022-09-22T11:51:56.213282+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/favicon.ico" host=dry-oasis-02543.herokuapp.com request_id=f5813669-3f1d-4333-bc6c-f4f2d0dd5b13 fwd="49.204.236.35" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2022-09-22T12:21:10.759124+00:00 heroku[web.1]: Idling
2022-09-22T12:21:10.764667+00:00 heroku[web.1]: State changed from up to down
2022-09-22T12:21:10.774495+00:00 heroku[worker.1]: Idling
2022-09-22T12:21:10.776324+00:00 heroku[worker.1]: State changed from up to down
2022-09-22T12:21:11.449023+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2022-09-22T12:21:11.643613+00:00 heroku[web.1]: Process exited with status 143
2022-09-22T12:21:12.711392+00:00 heroku[worker.1]: Stopping all processes with SIGTERM
2022-09-22T12:21:13.033420+00:00 heroku[worker.1]: Process exited with status 143
2022-09-22T12:22:59.026961+00:00 heroku[web.1]: Unidling
2022-09-22T12:22:59.034456+00:00 heroku[web.1]: State changed from down to starting
2022-09-22T12:22:59.069700+00:00 heroku[worker.1]: Unidling
2022-09-22T12:22:59.071316+00:00 heroku[worker.1]: State changed from down to starting
2022-09-22T12:23:01.147856+00:00 heroku[worker.1]: Starting process with command `node app.js`
2022-09-22T12:23:01.167784+00:00 heroku[web.1]: Starting process with command `npm start`
2022-09-22T12:23:01.741746+00:00 heroku[worker.1]: State changed from starting to up
2022-09-22T12:23:03.404493+00:00 app[worker.1]: Server started on port 3000
2022-09-22T12:23:03.564580+00:00 app[web.1]:
2022-09-22T12:23:03.564587+00:00 app[web.1]: > todolist-v1#1.0.0 start
2022-09-22T12:23:03.564588+00:00 app[web.1]: > node app.js
2022-09-22T12:23:03.564588+00:00 app[web.1]:
2022-09-22T12:23:04.268791+00:00 app[web.1]: Server started on port 3000
2022-09-22T12:23:04.584653+00:00 heroku[web.1]: State changed from starting to up
2022-09-22T12:23:33.451469+00:00 app[worker.1]: Here is the error
2022-09-22T12:23:34.310032+00:00 app[web.1]: Here is the error
2022-09-22T12:23:36.112393+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=dry-oasis-02543.herokuapp.com request_id=771ad4af-a2d0-4fe6-8fd8-a95259e627ea fwd="49.204.236.35" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2022-09-22T12:23:46.556173+00:00 app[web.1]: Error in the list
2022-09-22T12:24:06.516346+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/favicon.ico" host=dry-oasis-02543.herokuapp.com request_id=af42aa9e-a35a-477d-97e7-a9252d8fd9f0 fwd="49.204.236.35" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2022-09-22T12:24:12.292521+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=dry-oasis-02543.herokuapp.com request_id=924bf97b-becb-4bf2-92f8-30923d1e62d9 fwd="49.204.236.35" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0 protocol=https
2022-09-22T12:24:23.687465+00:00 app[web.1]: Error in the list
2022-09-22T12:24:43.688408+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/favicon.ico" host=dry-oasis-02543.herokuapp.com request_id=84fc8cc4-1aad-4fdf-be95-c8cd91b648ee fwd="49.204.236.35" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
2022-09-22T12:54:40.227336+00:00 heroku[web.1]: Idling
2022-09-22T12:54:40.232858+00:00 heroku[web.1]: State changed from up to down
2022-09-22T12:54:40.242617+00:00 heroku[worker.1]: Idling
2022-09-22T12:54:40.245598+00:00 heroku[worker.1]: State changed from up to down
2022-09-22T12:54:40.999737+00:00 heroku[worker.1]: Stopping all processes with SIGTERM
2022-09-22T12:54:41.244765+00:00 heroku[worker.1]: Process exited with status 143
2022-09-22T12:54:43.076058+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2022-09-22T12:54:43.355126+00:00 heroku[web.1]: Process exited with status 143
2022-09-22T13:06:03.062197+00:00 heroku[web.1]: Unidling
2022-09-22T13:06:03.066831+00:00 heroku[web.1]: State changed from down to starting
2022-09-22T13:06:03.118009+00:00 heroku[worker.1]: Unidling
2022-09-22T13:06:03.123303+00:00 heroku[worker.1]: State changed from down to starting
2022-09-22T13:06:05.208336+00:00 heroku[web.1]: Starting process with command `npm start`
2022-09-22T13:06:05.223738+00:00 heroku[worker.1]: Starting process with command `node app.js`
2022-09-22T13:06:05.898834+00:00 heroku[worker.1]: State changed from starting to up
2022-09-22T13:06:07.286374+00:00 app[web.1]:
2022-09-22T13:06:07.286485+00:00 app[web.1]: > todolist-v1#1.0.0 start
2022-09-22T13:06:07.286491+00:00 app[web.1]: > node app.js
2022-09-22T13:06:07.286492+00:00 app[web.1]:
2022-09-22T13:06:07.480766+00:00 app[worker.1]: Server started on port 3000
2022-09-22T13:06:07.798042+00:00 app[web.1]: Server started on port 3000
2022-09-22T13:06:08.202201+00:00 heroku[web.1]: State changed from starting to up
2022-09-22T13:06:37.514683+00:00 app[worker.1]: Here is the error
2022-09-22T13:06:37.839644+00:00 app[web.1]: Here is the error
2022-09-22T13:06:39.152554+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" host=dry-oasis-02543.herokuapp.com request_id=0a2548b5-c865-4d50-88ef-054bc6a5e1d4 fwd="49.204.236.35" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https
I am trying this from long time. Please help.
I uploaded telegram bot with webhook on Heroku but the app crashes.
I checked Heroku support but nothing helped, so I really do not know what might be the problem.
I set telegram webhook in the following way:
class Bot {
constructor(token) {
this.client = new TelegramBotClient(token,
{ webhook: { port: process.env.PORT || 5000 } }
);
this.client.setWebHook(`${config.heroku_app}/bot${token}`);
}
My Procfile:
web: node main.js
package.json contains
"scripts": {
"start": "node main.js"
}
There are no long running build processes happen during a deploy, so that also shouldn't be the cause.
Error logs:
2022-06-01T12:52:12.810740+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2022-06-01T12:52:12.848491+00:00 heroku[web.1]: Stopping process with SIGKILL
2022-06-01T12:52:13.000433+00:00 heroku[web.1]: Process exited with status 137
2022-06-01T12:52:13.090750+00:00 heroku[web.1]: State changed from starting to crashed
2022-06-01T12:52:15.688412+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=POST path="/{token}" host=notification-tg-bot.herokuapp.com request_id=7859b4ef-2a3d-4e61-8d8d-60513252502c fwd="91.108.6.71" dyno= connect= service= status=503 bytes= protocol=https
2022-06-01T12:53:15.778224+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=POST path="/{token}" host=notification-tg-bot.herokuapp.com request_id=aa04c555-c4c6-42d8-b254-bc6588b533d2 fwd="91.108.6.71" dyno= connect= service= status=503 bytes= protocol=https
const express = require ('express');
const bodyParser = require('body-parser');
var passwordHash = require('password-hash');
const cors = require('cors');
var knex = require('knex');
const register = require('./controllers/Register');
const signin = require('./controllers/Signin');
const profile = require('./controllers/Profile');
const image = require('./controllers/Image');
//var connectionString = "postgres://*USERNAME*:*PASSWORD*#*HOST*:*PORT*/*DATABASE*"
const db = knex({
client: 'pg',
connection: {
connectionString: process.env.DATABASE_URL,
ssl: true,
}
})
const app=express();
app.use(bodyParser.json());
app.use(cors());
app.get('/',(req, res)=>{
res.send("it is working")
})
app.post('/signin',(req,res)=>{signin.handleSignIn(req,res,db,passwordHash)})
app.post('/register',(req, res)=>{register.handleRegister(req, res, db,passwordHash)})
app.get('/profile/:id', (req,res)=>{profile.handleProfileGet(req,res,db)})
app.put('/image',(req,res)=>{image.handleImage(req,res,db)})
app.post('/imageurl',(req,res)=>{image.handleApiCall(req,res)})
app.listen(process.env.PORT || 3000, ()=>{
console.log(`app is running on port ${process.env.PORT}`)
})
This is my server.js file
unable to figure out error I added all the changes using git add then used git commit -m "changed port" git push heroku master
git logs --tail (getting error here)
rohit#rohit-Vostro-3583:~/Desktop/smartbrainAPI$ heroku logs --tail
2020-04-19T11:38:00.460877+00:00 heroku[web.1]: State changed from crashed to starting
2020-04-19T11:38:04.722372+00:00 app[web.1]:
2020-04-19T11:38:04.722404+00:00 app[web.1]: > node#1.0.0 start /app
2020-04-19T11:38:04.722404+00:00 app[web.1]: > node server.js
2020-04-19T11:38:04.722405+00:00 app[web.1]:
2020-04-19T11:38:05.064464+00:00 app[web.1]: /app/server.js:21
2020-04-19T11:38:05.064499+00:00 app[web.1]: db.connect();
2020-04-19T11:38:05.064500+00:00 app[web.1]: ^
2020-04-19T11:38:05.064500+00:00 app[web.1]:
2020-04-19T11:38:05.064504+00:00 app[web.1]: TypeError: db.connect is not a function
2020-04-19T11:38:05.064505+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:21:6)
2020-04-19T11:38:05.064506+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1156:30)
2020-04-19T11:38:05.064506+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
2020-04-19T11:38:05.064506+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:1000:32)
2020-04-19T11:38:05.064507+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:899:14)
2020-04-19T11:38:05.064507+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
2020-04-19T11:38:05.064508+00:00 app[web.1]: at internal/main/run_main_module.js:18:47
2020-04-19T11:38:05.070768+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-04-19T11:38:05.071050+00:00 app[web.1]: npm ERR! errno 1
2020-04-19T11:38:05.072100+00:00 app[web.1]: npm ERR! node#1.0.0 start: `node server.js`
2020-04-19T11:38:05.072245+00:00 app[web.1]: npm ERR! Exit status 1
2020-04-19T11:38:05.072422+00:00 app[web.1]: npm ERR!
2020-04-19T11:38:05.072557+00:00 app[web.1]: npm ERR! Failed at the node#1.0.0 start script.
2020-04-19T11:38:05.072688+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-04-19T11:38:05.077328+00:00 app[web.1]:
2020-04-19T11:38:05.077531+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-04-19T11:38:05.077662+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2020-04-19T11_38_05_073Z-debug.log
2020-04-19T11:38:05.151564+00:00 heroku[web.1]: State changed from starting to crashed
2020-04-19T11:39:03.000000+00:00 app[api]: Build started by user rohitjain991100#gmail.com
2020-04-19T11:39:26.226816+00:00 app[api]: Deploy cf844469 by user rohitjain991100#gmail.com
2020-04-19T11:39:26.226816+00:00 app[api]: Release v20 created by user rohitjain991100#gmail.com
2020-04-19T11:39:26.932529+00:00 heroku[web.1]: State changed from crashed to starting
2020-04-19T11:39:27.000000+00:00 app[api]: Build succeeded
2020-04-19T11:39:34.492601+00:00 app[web.1]:
2020-04-19T11:39:34.492681+00:00 app[web.1]: > node#1.0.0 start /app
2020-04-19T11:39:34.492682+00:00 app[web.1]: > node server.js
2020-04-19T11:39:34.492683+00:00 app[web.1]:
2020-04-19T11:39:35.127798+00:00 heroku[web.1]: State changed from starting to up
2020-04-19T11:39:35.085705+00:00 app[web.1]: app is running on port 31626
2020-04-19T11:53:00.000000+00:00 app[api]: Build started by user rohitjain991100#gmail.com
2020-04-19T11:53:22.454500+00:00 heroku[web.1]: Restarting
2020-04-19T11:53:22.458236+00:00 heroku[web.1]: State changed from up to starting
2020-04-19T11:53:22.256081+00:00 app[api]: Release v21 created by user rohitjain991100#gmail.com
2020-04-19T11:53:22.256081+00:00 app[api]: Deploy 5c8d0f48 by user rohitjain991100#gmail.com
2020-04-19T11:53:23.000000+00:00 app[api]: Build succeeded
2020-04-19T11:53:27.273472+00:00 app[web.1]:
2020-04-19T11:53:27.273493+00:00 app[web.1]: > node#1.0.0 start /app
2020-04-19T11:53:27.273493+00:00 app[web.1]: > node server.js
2020-04-19T11:53:27.273493+00:00 app[web.1]:
2020-04-19T11:53:27.734584+00:00 heroku[web.1]: State changed from starting to up
2020-04-19T11:53:27.649117+00:00 app[web.1]: app is running on port 30116
2020-04-19T11:53:47.570119+00:00 heroku[router]: at=info method=GET path="/" host=warm-reef-38212.herokuapp.com request_id=3624d2fe-2e3a-4e0c-99d0-3f06882d864c fwd="157.39.217.175" dyno=web.1 connect=3ms service=12ms status=304 bytes=181 protocol=https
2020-04-19T11:54:51.279964+00:00 heroku[router]: at=info method=OPTIONS path="/" host=warm-reef-38212.herokuapp.com request_id=2ee65713-56e6-45b2-ba85-8d5aac800275 fwd="157.39.217.175" dyno=web.1 connect=1ms service=3ms status=204 bytes=301 protocol=https
2020-04-19T11:59:28.292870+00:00 heroku[router]: at=info method=OPTIONS path="/register" host=warm-reef-38212.herokuapp.com request_id=ef749eda-243d-4d3f-aedd-92c995701359 fwd="157.39.217.175" dyno=web.1 connect=1ms service=2ms status=204 bytes=301 protocol=https
2020-04-19T11:59:32.895743+00:00 heroku[router]: at=info method=OPTIONS path="/signin" host=warm-reef-38212.herokuapp.com request_id=34278a55-19f1-4ee1-9eae-0d9d60e0a6bc fwd="157.39.217.175" dyno=web.1 connect=1ms service=4ms status=204 bytes=301 protocol=https
2020-04-19T11:59:33.562086+00:00 heroku[router]: at=info method=POST path="/signin" host=warm-reef-38212.herokuapp.com request_id=2087a4b7-1701-4c2c-91de-3ee3085e861d fwd="157.39.217.175" dyno=web.1 connect=1ms service=41ms status=400 bytes=267 protocol=https
2020-04-19T11:59:33.878990+00:00 heroku[router]: at=info method=POST path="/signin" host=warm-reef-38212.herokuapp.com request_id=b47adc7b-6c48-4d42-b69f-12544286a6d4 fwd="157.39.217.175" dyno=web.1 connect=0ms service=16ms status=400 bytes=267 protocol=https
2020-04-19T11:59:34.454755+00:00 heroku[router]: at=info method=POST path="/signin" host=warm-reef-38212.herokuapp.com request_id=518c21f9-5d5f-4860-b2a8-e48c84096f8e fwd="157.39.217.175" dyno=web.1 connect=0ms service=11ms status=400 bytes=267 protocol=https
2020-04-19T11:59:34.565367+00:00 heroku[router]: at=info method=POST path="/signin" host=warm-reef-38212.herokuapp.com request_id=f63998c3-7850-435c-85d2-efbbde3040ef fwd="157.39.217.175" dyno=web.1 connect=2ms service=14ms status=400 bytes=267 protocol=https
2020-04-19T11:59:34.871204+00:00 heroku[router]: at=info method=POST path="/signin" host=warm-reef-38212.herokuapp.com request_id=a2322ada-8faf-4964-b5ea-76c68bba69b7 fwd="157.39.217.175" dyno=web.1 connect=1ms service=23ms status=400 bytes=267 protocol=https
2020-04-19T11:59:34.992259+00:00 heroku[router]: at=info method=POST path="/signin" host=warm-reef-38212.herokuapp.com request_id=7e896a02-2d8f-4713-99fb-26ae2bb01a02 fwd="157.39.217.175" dyno=web.1 connect=1ms service=10ms status=400 bytes=267 protocol=https
2020-04-19T12:31:42.742729+00:00 heroku[web.1]: Idling
2020-04-19T12:31:42.746564+00:00 heroku[web.1]: State changed from up to down
2020-04-20T03:36:37.247697+00:00 heroku[web.1]: Unidling
2020-04-20T03:36:37.262797+00:00 heroku[web.1]: State changed from down to starting
2020-04-20T03:36:42.828317+00:00 app[web.1]:
2020-04-20T03:36:42.828354+00:00 app[web.1]: > node#1.0.0 start /app
2020-04-20T03:36:42.828355+00:00 app[web.1]: > node server.js
2020-04-20T03:36:42.828355+00:00 app[web.1]:
2020-04-20T03:36:43.203099+00:00 app[web.1]: app is running on port 11796
2020-04-20T03:36:43.849848+00:00 heroku[web.1]: State changed from starting to up
2020-04-20T03:36:45.324642+00:00 heroku[router]: at=info method=GET path="/" host=warm-reef-38212.herokuapp.com request_id=40c07246-2b5b-4079-bda3-04b6347c2290 fwd="157.39.3.225" dyno=web.1 connect=0ms service=13ms status=304 bytes=181 protocol=https
2020-04-20T03:36:45.998463+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=warm-reef-38212.herokuapp.com request_id=e3b41154-ef4f-4823-833f-74a8dc7b29c2 fwd="157.39.3.225" dyno=web.1 connect=0ms service=6ms status=404 bytes=426 protocol=https
2020-04-20T03:54:04.000000+00:00 app[api]: Build started by user rohitjain991100#gmail.com
2020-04-20T03:54:26.193272+00:00 app[api]: Deploy 1da13236 by user rohitjain991100#gmail.com
2020-04-20T03:54:26.193272+00:00 app[api]: Release v22 created by user rohitjain991100#gmail.com
2020-04-20T03:54:27.082771+00:00 heroku[web.1]: Restarting
2020-04-20T03:54:27.096340+00:00 heroku[web.1]: State changed from up to starting
2020-04-20T03:54:27.000000+00:00 app[api]: Build succeeded
2020-04-20T03:54:31.467317+00:00 app[web.1]:
2020-04-20T03:54:31.467339+00:00 app[web.1]: > node#1.0.0 start /app
2020-04-20T03:54:31.467340+00:00 app[web.1]: > node server.js
2020-04-20T03:54:31.467340+00:00 app[web.1]:
2020-04-20T03:54:31.978215+00:00 heroku[web.1]: State changed from starting to up
2020-04-20T03:54:31.771327+00:00 app[web.1]: app is running on port 36319
2020-04-20T03:57:17.192518+00:00 heroku[router]: at=info method=OPTIONS path="/register" host=warm-reef-38212.herokuapp.com request_id=5854e26c-7119-4abc-bdd5-b398b8f051d0 fwd="157.39.119.21" dyno=web.1 connect=1ms service=9ms status=204 bytes=301 protocol=https
2020-04-20T03:57:17.634127+00:00 heroku[router]: at=info method=OPTIONS path="/signin" host=warm-reef-38212.herokuapp.com request_id=9bbc745e-1e7f-47c6-90d9-08e1aac92589 fwd="157.39.3.225" dyno=web.1 connect=1ms service=2ms status=204 bytes=301 protocol=https
2020-04-20T03:57:19.675739+00:00 heroku[router]: at=info method=POST path="/signin" host=warm-reef-38212.herokuapp.com request_id=8108baef-41d0-4b0c-a5dc-3967fe2098e4 fwd="157.39.3.225" dyno=web.1 connect=1ms service=24ms status=400 bytes=267 protocol=https
2020-04-20T04:18:31.000000+00:00 app[api]: Build started by user rohitjain991100#gmail.com
2020-04-20T04:18:52.526320+00:00 app[api]: Deploy 1c1b07e7 by user rohitjain991100#gmail.com
2020-04-20T04:18:52.526320+00:00 app[api]: Release v23 created by user rohitjain991100#gmail.com
2020-04-20T04:18:53.554662+00:00 heroku[web.1]: Restarting
2020-04-20T04:18:53.558703+00:00 heroku[web.1]: State changed from up to starting
2020-04-20T04:18:53.000000+00:00 app[api]: Build succeeded
2020-04-20T04:18:57.947008+00:00 app[web.1]:
2020-04-20T04:18:57.947025+00:00 app[web.1]: > node#1.0.0 start /app
2020-04-20T04:18:57.947026+00:00 app[web.1]: > node server.js
2020-04-20T04:18:57.947026+00:00 app[web.1]:
2020-04-20T04:18:58.227322+00:00 app[web.1]: app is running on port 12966
2020-04-20T04:18:58.560135+00:00 heroku[web.1]: State changed from starting to up
^C
rohit#rohit-Vostro-3583:~/Desktop/smartbrainAPI$ heroku pg:info
=== DATABASE_URL
Plan: Hobby-dev
Status: Available
Connections: 0/20
PG Version: 12.2
Created: 2020-04-19 08:42 UTC
Data Size: 8.3 MB
Tables: 2
Rows: 1/10000 (In compliance)
Fork/Follow: Unsupported
Rollback: Unsupported
Cont
<!-- begin snippet: js hide: false console: true babel: false -->
This is what error I am getting This is showing that i have database also for it
Help me in finding out what to change
I ahve done git add .
git commit
git push heroku master
Heroku open is also working finely
Dont know what error is
{
"name": "node",
"version": "1.0.0",
"description": "no",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js",
"start:dev": "nodemon server.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"nodemon": "^2.0.3"
},
"dependencies": {
"bcrypt-nodejs": "0.0.3",
"body-parser": "^1.19.0",
"clarifai": "^2.9.1",
"cors": "^2.8.5",
"express": "^4.17.1",
"knex": "^0.20.13",
"password-hash": "^1.2.2",
"pg": "^8.0.1",
"serve": "^11.3.0"
}
}
This is my package.json file
I deployed a Node.js application on Heroku through CLI. The steps I followed are
Git add .
Git commit -am "message"
git heroku push master
heroku open
I didnt get any error and when I run heroku open, the app is running on my browser. The problem is that when I try to run it using different browsers or through mobile browser its not loading.
This is the url : https://smit21.herokuapp.com/
Heroku logs:
2018-09-22T10:45:10.910105+00:00 heroku[web.1]: State changed from starting to up
2018-09-22T10:45:11.024839+00:00 app[web.1]: mongo is successfully Connected
2018-09-22T10:45:11.730224+00:00 heroku[router]: at=info method=GET path="/" host=smit21.herokuapp.com request_id=3da0a9c2-6a20-4f07-9832-03384d0030f0 fwd="130.217.199.41" dyno=web.1 connect=1ms service=15ms status=304 bytes=149 protocol=https
2018-09-22T10:45:22.179407+00:00 heroku[router]: at=info method=GET path="/style.css" host=smit21.herokuapp.com request_id=9e8e12f2-3a10-4737-ad59-5a80fc543e15 fwd="130.217.199.41" dyno=web.1 connect=0ms service=22ms status=200 bytes=1671 protocol=https
2018-09-22T10:45:22.467080+00:00 heroku[router]: at=info method=GET path="/service-worker.js" host=smit21.herokuapp.com request_id=23c73ab0-c7dc-4795-8071-96f227c25de7 fwd="130.217.199.41" dyno=web.1 connect=0ms service=6ms status=200 bytes=1671 protocol=https
2018-09-22T10:46:42.380939+00:00 heroku[router]: at=info method=GET path="/" host=smit21.herokuapp.com request_id=3d720461-a453-4406-ab50-e619e4a1ca17 fwd="130.217.199.41" dyno=web.1 connect=1ms service=4ms status=304 bytes=149 protocol=https
2018-09-22T11:20:22.770459+00:00 heroku[router]: at=info method=GET path="/" host=smit21.herokuapp.com request_id=12c5acba-bf57-4fff-b105-872666b2cedb fwd="130.217.252.116" dyno=web.1 connect=1ms service=3ms status=200 bytes=205 protocol=http
2018-09-22T11:20:23.078071+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=smit21.herokuapp.com request_id=b4012891-eeb7-4475-93e0-42b95464b751 fwd="130.217.252.116" dyno=web.1 connect=1ms service=11ms status=200 bytes=1671 protocol=http
2018-09-22T11:21:23.714105+00:00 heroku[web.1]: Idling
2018-09-22T11:21:23.714612+00:00 heroku[web.1]: State changed from up to down
2018-09-22T11:21:24.902989+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2018-09-22T11:21:25.009609+00:00 heroku[web.1]: Process exited with status 143
2018-09-22T12:19:21.492774+00:00 heroku[web.1]: Unidling
2018-09-22T12:19:21.493013+00:00 heroku[web.1]: State changed from down to starting
2018-09-22T12:19:31.538143+00:00 heroku[web.1]: Starting process with command `npm start`
2018-09-22T12:19:34.484663+00:00 app[web.1]:
2018-09-22T12:19:34.484689+00:00 app[web.1]: > connectify#1.0.0 start /app
2018-09-22T12:19:34.484691+00:00 app[web.1]: > node server.js
2018-09-22T12:19:34.484692+00:00 app[web.1]:
2018-09-22T12:19:36.922548+00:00 heroku[web.1]: State changed from starting to up
2018-09-22T12:19:36.806116+00:00 app[web.1]: (node:21) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
2018-09-22T12:19:36.808856+00:00 app[web.1]: server running on ${port}
2018-09-22T12:19:37.512586+00:00 app[web.1]: mongo is successfully Connected
2018-09-22T12:19:37.644321+00:00 heroku[router]: at=info method=GET path="/" host=smit21.herokuapp.com request_id=ee35c390-7a01-47cd-a735-fbc0a09dfa17 fwd="67.81.155.224" dyno=web.1 connect=1ms service=33ms status=200 bytes=205 protocol=https
2018-09-22T12:19:38.625988+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=smit21.herokuapp.com request_id=59431a7d-0435-482e-be56-bc40ec0d7040 fwd="67.81.155.224" dyno=web.1 connect=1ms service=18ms status=200 bytes=1671 protocol=https
2018-09-22T12:37:21.169018+00:00 heroku[router]: at=info method=GET path="/" host=smit21.herokuapp.com request_id=a7f0cd4d-564d-4b2c-b2f5-c6b447cf113d fwd="42.113.162.220" dyno=web.1 connect=0ms service=8ms status=200 bytes=205 protocol=https
2018-09-22T12:37:21.688111+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=smit21.herokuapp.com request_id=e942379d-0505-4c52-8a79-06774538178a fwd="42.113.162.220" dyno=web.1 connect=0ms service=6ms status=200 bytes=1671 protocol=https
2018-09-22T13:12:41.189319+00:00 heroku[web.1]: Idling
2018-09-22T13:12:41.189770+00:00 heroku[web.1]: State changed from up to down
2018-09-22T13:12:42.083740+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2018-09-22T13:12:42.244254+00:00 heroku[web.1]: Process exited with status 143
2018-09-22T13:40:40.011490+00:00 heroku[web.1]: Unidling
2018-09-22T13:40:40.011737+00:00 heroku[web.1]: State changed from down to starting
2018-09-22T13:40:49.782284+00:00 heroku[web.1]: Starting process with command `npm start`
2018-09-22T13:40:52.738181+00:00 app[web.1]:
2018-09-22T13:40:52.738215+00:00 app[web.1]: > connectify#1.0.0 start /app
2018-09-22T13:40:52.738216+00:00 app[web.1]: > node server.js
2018-09-22T13:40:52.738217+00:00 app[web.1]:
2018-09-22T13:40:56.345158+00:00 app[web.1]: (node:21) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
2018-09-22T13:40:56.347202+00:00 app[web.1]: server running on ${port}
2018-09-22T13:40:56.727105+00:00 heroku[web.1]: State changed from starting to up
2018-09-22T13:40:57.065561+00:00 app[web.1]: mongo is successfully Connected
2018-09-22T13:40:58.175235+00:00 heroku[router]: at=info method=GET path="/" host=smit21.herokuapp.com request_id=11684ba9-34ff-4e3c-b80d-bb4738826fba fwd="185.20.6.43" dyno=web.1 connect=1ms service=27ms status=200 bytes=205 protocol=https
2018-09-22T14:13:38.051816+00:00 heroku[web.1]: Idling
2018-09-22T14:13:38.052343+00:00 heroku[web.1]: State changed from up to down
2018-09-22T14:13:39.140424+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2018-09-22T14:13:39.513941+00:00 heroku[web.1]: Process exited with status 143
2018-09-22T17:49:30.699850+00:00 heroku[web.1]: Unidling
2018-09-22T17:49:30.700095+00:00 heroku[web.1]: State changed from down to starting
2018-09-22T17:49:30.712308+00:00 heroku[web.1]: Unidling
2018-09-22T17:49:30.712582+00:00 heroku[web.1]: State changed from down to starting
2018-09-22T17:49:40.987766+00:00 heroku[web.1]: Starting process with command `npm start`
2018-09-22T17:49:43.759282+00:00 app[web.1]:
2018-09-22T17:49:43.759314+00:00 app[web.1]: > connectify#1.0.0 start /app
2018-09-22T17:49:43.759315+00:00 app[web.1]: > node server.js
2018-09-22T17:49:43.759316+00:00 app[web.1]:
2018-09-22T17:49:46.124612+00:00 app[web.1]: (node:21) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
2018-09-22T17:49:46.126979+00:00 app[web.1]: server running on ${port}
2018-09-22T17:49:46.522505+00:00 heroku[web.1]: State changed from starting to up
2018-09-22T17:49:46.644735+00:00 app[web.1]: mongo is successfully Connected
2018-09-22T17:49:48.917314+00:00 heroku[router]: at=info method=GET path="/robots.txt" host=smit21.herokuapp.com request_id=903a4039-97bc-4828-812b-f1acc2cdc513 fwd="37.170.118.162" dyno=web.1 connect=0ms service=68ms status=200 bytes=1671 protocol=https
2018-09-22T17:49:48.876338+00:00 heroku[router]: at=info method=GET path="/" host=smit21.herokuapp.com request_id=9e23b162-b656-447f-a89e-ae5130b3b8bc fwd="37.170.118.162" dyno=web.1 connect=1ms service=31ms status=200 bytes=205 protocol=https
2018-09-22T17:49:51.070701+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=smit21.herokuapp.com request_id=3aaa52db-476e-411f-b6aa-8158dff352cd fwd="37.170.118.162" dyno=web.1 connect=0ms service=8ms status=200 bytes=1671 protocol=https
2018-09-22T18:27:03.807779+00:00 heroku[web.1]: Idling
2018-09-22T18:27:03.808281+00:00 heroku[web.1]: State changed from up to down
2018-09-22T18:27:04.892238+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2018-09-22T18:27:05.038741+00:00 heroku[web.1]: Process exited with status 143
2018-09-22T22:01:22.982040+00:00 heroku[web.1]: Unidling
2018-09-22T22:01:22.982330+00:00 heroku[web.1]: State changed from down to starting
2018-09-22T22:01:33.438308+00:00 heroku[web.1]: Starting process with command `npm start`
2018-09-22T22:01:36.517339+00:00 app[web.1]:
2018-09-22T22:01:36.517389+00:00 app[web.1]: > connectify#1.0.0 start /app
2018-09-22T22:01:36.517391+00:00 app[web.1]: > node server.js
2018-09-22T22:01:36.517392+00:00 app[web.1]:
2018-09-22T22:01:39.339911+00:00 app[web.1]: (node:21) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
2018-09-22T22:01:39.348746+00:00 app[web.1]: server running on ${port}
2018-09-22T22:01:39.761169+00:00 heroku[web.1]: State changed from starting to up
2018-09-22T22:01:39.933342+00:00 app[web.1]: mongo is successfully Connected
2018-09-22T22:01:41.162080+00:00 heroku[router]: at=info method=GET path="/" host=smit21.herokuapp.com request_id=d176ed5c-f629-4964-8e78-2bb73b521af3 fwd="185.20.6.141" dyno=web.1 connect=0ms service=26ms status=200 bytes=205 protocol=https
2018-09-22T22:36:02.306389+00:00 heroku[web.1]: Idling
2018-09-22T22:36:02.306919+00:00 heroku[web.1]: State changed from up to down
2018-09-22T22:36:03.163997+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2018-09-22T22:36:03.277923+00:00 heroku[web.1]: Process exited with status 143
2018-09-23T00:13:07.000615+00:00 heroku[web.1]: Unidling
2018-09-23T00:13:07.000863+00:00 heroku[web.1]: State changed from down to starting
2018-09-23T00:13:12.849997+00:00 heroku[web.1]: Starting process with command `npm start`
2018-09-23T00:13:14.641841+00:00 app[web.1]:
2018-09-23T00:13:14.641858+00:00 app[web.1]: > connectify#1.0.0 start /app
2018-09-23T00:13:14.641860+00:00 app[web.1]: > node server.js
2018-09-23T00:13:14.641861+00:00 app[web.1]:
2018-09-23T00:13:15.926398+00:00 app[web.1]: (node:21) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
2018-09-23T00:13:15.927682+00:00 app[web.1]: server running on ${port}
2018-09-23T00:13:16.612593+00:00 heroku[web.1]: State changed from starting to up
2018-09-23T00:13:16.526867+00:00 app[web.1]: mongo is successfully Connected
2018-09-23T00:13:19.158301+00:00 heroku[router]: at=info method=GET path="/" host=smit21.herokuapp.com request_id=1753b2d3-291f-4cc4-a02d-184ed39337e9 fwd="24.87.72.248" dyno=web.1 connect=0ms service=10ms status=200 bytes=205 protocol=https
2018-09-23T00:13:19.821530+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=smit21.herokuapp.com request_id=a4270213-9ac1-4e68-827f-ea7e9ac365ba fwd="24.87.72.248" dyno=web.1 connect=0ms service=13ms status=200 bytes=1671 protocol=https
2018-09-23T00:49:06.417379+00:00 heroku[web.1]: Idling
2018-09-23T00:49:06.417954+00:00 heroku[web.1]: State changed from up to down
2018-09-23T00:49:07.535197+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2018-09-23T00:49:07.751341+00:00 heroku[web.1]: Process exited with status 143
Screenshot when trying to run heroku open
server.js
const express = require('express');
const mongoose = require('mongoose');
const bodyParser = require('body-parser');
const passport = require('passport');
const path = require('path');
const users = require('./routes/api/users');
const profile = require('./routes/api/profile');
const posts = require('./routes/api/posts');
const app = express();
// Body parser middleware
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
// DB Config
const db = require('./config/keys').mongoURI;
// Connect to MongoDB
mongoose
.connect(db)
.then(() => console.log('MongoDB Connected'))
.catch(err => console.log(err));
// Passport middleware
app.use(passport.initialize());
// Passport Config
require('./config/passport')(passport);
// Use Routes
app.use('/api/users', users);
app.use('/api/profile', profile);
app.use('/api/posts', posts);
// Server static assets if in production
if (process.env.NODE_ENV === 'production') {
// Set static folder
app.use(express.static('client/build'));
app.get('*', (req, res) => {
res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html'));
});
}
const port = process.env.PORT || 5000;
app.listen(port, () => console.log(`Server running on port ${port}`));
package.json
"heroku-postbuild":
"NPM_CONFIG_PRODUCTION=false npm install --prefix frontend && npm run build --prefix frontend"
I created an React app (using CRA) with Nodejs backend. Now I tried hosting it. (I've hosted few apps with same stack but didn't faced any issues).
I'm starting both Nodejs and React app using concurrently module with npm run dev.
But this time I'm getting an error and I can't figure out why.
This is what I get when I go the link.
Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.
index.js
const express = require('express');
const routes = require('./routes');
const app = express();
const port = 5000 || process.env.PORT;
routes(app);
if(process.env.NODE_ENV === 'production'){
app.use(express.static('client/build'));
const path = require('path');
app.get("*", (req,res) => {
res.sendFile(path.resolve(__dirname,'client','build','index.html'));
})
}
app.listen(port, () => console.log(`Server is running on port ${port}`));
package.json
{
"name": "check-market",
"version": "1.0.0",
"description": "This is a react-nodejs based crypto market checking app",
"main": "index.js",
"scripts": {
"start": "node index.js",
"server": "nodemon index.js",
"test": "echo \"Error: no test specified\" && exit 1",
"client": "npm run start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
},
"author": "abcd",
"license": "ISC",
"dependencies": {
"concurrently": "^3.5.1",
"cryptocoins-icons": "^2.7.0",
"express": "^4.16.2",
"node-fetch": "^2.0.0",
"nodemon": "^1.14.12"
}
}
heroku logs
2018-04-05T13:41:49.283535+00:00 app[web.1]: [1]2018-04-05T13:41:49.560174+00:00 app[web.1]: [0] Server is running on port 5000
2018-04-05T13:41:51.049613+00:00 app[web.1]: [1] Starting the development server...
2018-04-05T13:41:51.049625+00:00 app[web.1]: [1]
2018-04-05T13:41:51.202463+00:00 heroku[web.1]: State changed from starting to up
2018-04-05T13:42:00.969286+00:00 app[web.1]: [1] Compiled with warnings.
2018-04-05T13:42:00.969303+00:00 app[web.1]: [1]
2018-04-05T13:42:00.969584+00:00 app[web.1]: [1] ./src/components/currency_main.js
2018-04-05T13:42:00.969587+00:00 app[web.1]: [1] Line 49: Expected to return a value in arrow function array-callback-return
2018-04-05T13:42:00.969588+00:00 app[web.1]: [1]
2018-04-05T13:42:00.969590+00:00 app[web.1]: [1] Search for the keywords to learn more about each warning.
2018-04-05T13:42:00.969593+00:00 app[web.1]: [1] To ignore, add // eslint-disable-next-line to the line before.
2018-04-05T13:42:00.969594+00:00 app[web.1]: [1]2018-04-05T13:42:17.377067+00:00 heroku[router]: at=info method=GET path="/" host=cryptic-hollows-53642.herokuapp.com request_id=fa334992-ebb7-4a38-8c2d-e5c09849dcef fwd="112.134.75.196" dyno=web.1 connect=1ms service=13ms status=200 bytes=219 protocol=https
2018-04-05T13:42:18.397503+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=cryptic-hollows-53642.herokuapp.com request_id=e716c9cb-e910-4f98-8346-4195c6d623ca fwd="112.134.75.196" dyno=web.1 connect=0ms service=7ms status=200 bytes=219 protocol=https
2018-04-05T13:44:47.000000+00:00 app[api]: Build started by user thidasaone#gmail.com
2018-04-05T13:44:47.000000+00:00 app[api]: Build succeeded
2018-04-05T13:46:08.491686+00:00 app[api]: Deploy 0ae9d4f3 by user thidasaone#gmail.com2018-04-05T13:46:08.491686+00:00 app[api]: Release v8 created by user thidasaone#gmail.com2018-04-05T13:46:10.417551+00:00 heroku[web.1]: Restarting
2018-04-05T13:46:10.418403+00:00 heroku[web.1]: State changed from up to starting2018-04-05T13:46:12.169322+00:00 heroku[web.1]: Stopping all processes with SIGTERM2018-04-05T13:46:12.258942+00:00 heroku[web.1]: Process exited with status 143
2018-04-05T13:46:17.859328+00:00 heroku[web.1]: Starting process with command `npm run dev`2018-04-05T13:46:20.219087+00:00 app[web.1]:2018-04-05T13:46:20.219128+00:00 app[web.1]: > check-market#1.0.0 dev /app
2018-04-05T13:46:20.219130+00:00 app[web.1]: > concurrently "npm run server" "npm run client"2018-04-05T13:46:20.219132+00:00 app[web.1]:2018-04-05T13:46:20.817238+00:00 app[web.1]: [0]
2018-04-05T13:46:20.817262+00:00 app[web.1]: [0] > check-market#1.0.0 server /app
2018-04-05T13:46:20.817265+00:00 app[web.1]: [0] > nodemon index.js
2018-04-05T13:46:20.817267+00:00 app[web.1]: [0]
2018-04-05T13:46:20.865621+00:00 app[web.1]: [1]
2018-04-05T13:46:20.865626+00:00 app[web.1]: [1] > check-market#1.0.0 client /app
2018-04-05T13:46:20.865635+00:00 app[web.1]: [1] > npm run start --prefix client
2018-04-05T13:46:20.865636+00:00 app[web.1]: [1]
2018-04-05T13:46:21.154092+00:00 app[web.1]: [0] [nodemon] 1.14.12
2018-04-05T13:46:21.155353+00:00 app[web.1]: [0] [nodemon] to restart at any time, enter `rs`
2018-04-05T13:46:21.155695+00:00 app[web.1]: [0] [nodemon] watching: *.*
2018-04-05T13:46:21.156422+00:00 app[web.1]: [0] [nodemon] starting `node index.js`
2018-04-05T13:46:21.225033+00:00 app[web.1]: [1]
2018-04-05T13:46:21.225037+00:00 app[web.1]: [1] > client#0.1.0 start /app/client
2018-04-05T13:46:21.225039+00:00 app[web.1]: [1] > react-scripts start
2018-04-05T13:46:21.225041+00:00 app[web.1]: [1]
2018-04-05T13:46:21.390693+00:00 app[web.1]: [0] Server is running on port 5000
2018-04-05T13:46:22.929315+00:00 app[web.1]: [1] [HPM] Proxy created: function (pathname) {
2018-04-05T13:46:22.929329+00:00 app[web.1]: [1] return mayProxy(pathname) && pathname.match(context);
2018-04-05T13:46:22.929331+00:00 app[web.1]: [1] } -> http://localhost:5000
2018-04-05T13:46:22.940428+00:00 app[web.1]: [1] Starting the development server...
2018-04-05T13:46:22.940431+00:00 app[web.1]: [1]
2018-04-05T13:46:23.520069+00:00 heroku[web.1]: State changed from starting to up
2018-04-05T13:46:31.231306+00:00 heroku[router]: at=info method=GET path="/" host=cryptic-hollows-53642.herokuapp.com request_id=ec7762d5-3d9d-4512-96bf-5e51fd57e531 fwd="112.134.75.196" dyno=web.1 connect=1ms service=35ms status=304 bytes=150 protocol=https
2018-04-05T13:46:32.041938+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=cryptic-hollows-53642.herokuapp.com request_id=51901fca-b454-4e15-891f-54157d6ecffa fwd="112.134.75.196" dyno=web.1 connect=1ms service=74ms status=304 bytes=150 protocol=https
2018-04-05T13:46:34.656623+00:00 app[web.1]: [1]
2018-04-05T13:46:34.656609+00:00 app[web.1]: [1] Compiled with warnings.
2018-04-05T13:46:34.656627+00:00 app[web.1]: [1] Line 49: Expected to return a value in arrow function array-callback-return
2018-04-05T13:46:34.656629+00:00 app[web.1]: [1]
2018-04-05T13:46:34.656650+00:00 app[web.1]: [1] Search for the keywords to learn more about each warning.
2018-04-05T13:46:34.656625+00:00 app[web.1]: [1] ./src/components/currency_main.js
2018-04-05T13:46:34.656652+00:00 app[web.1]: [1] To ignore, add // eslint-disable-next-line to the line before.
2018-04-05T13:46:34.656654+00:00 app[web.1]: [1]
2018-04-05T13:47:01.000000+00:00 app[api]: Build started by user thidasaone#gmail.com
2018-04-05T13:48:18.696342+00:00 heroku[router]: at=info method=GET path="/" host=cryptic-hollows-53642.herokuapp.com request_id=9b941ec9-ac57-465f-8270-ff6b576e7a7e fwd="112.134.75.196" dyno=web.1 connect=1ms service=4ms status=304 bytes=150 protocol=https
2018-04-05T13:48:19.715353+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=cryptic-hollows-53642.herokuapp.com request_id=9dce4cdb-3251-4371-a6dc-17f5157c4c91 fwd="112.134.75.196" dyno=web.1 connect=1ms service=4ms status=200 bytes=219 protocol=https
2018-04-05T13:48:23.281435+00:00 heroku[web.1]: Restarting
2018-04-05T13:48:23.283219+00:00 heroku[web.1]: State changed from up to starting
2018-04-05T13:48:24.367174+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2018-04-05T13:48:24.460758+00:00 heroku[web.1]: Process exited with status 143
2018-04-05T13:48:22.235400+00:00 app[api]: Deploy f9c11456 by user thidasaone#gmail.com
2018-04-05T13:48:22.235400+00:00 app[api]: Release v9 created by user thidasaone#gmail.com
2018-04-05T13:47:01.000000+00:00 app[api]: Build succeeded
2018-04-05T13:48:31.022921+00:00 heroku[web.1]: Starting process with command `npm start`
2018-04-05T13:48:32.988916+00:00 app[web.1]:
2018-04-05T13:48:32.988939+00:00 app[web.1]: > check-market#1.0.0 start /app
2018-04-05T13:48:32.988941+00:00 app[web.1]: > node index.js
2018-04-05T13:48:32.988943+00:00 app[web.1]:
2018-04-05T13:48:33.185499+00:00 app[web.1]: Server is running on port 5000
2018-04-05T13:49:31.116916+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2018-04-05T13:49:31.093326+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 secondsof launch
2018-04-05T13:49:31.093493+00:00 heroku[web.1]: Stopping process with SIGKILL
2018-04-05T13:49:31.174105+00:00 heroku[web.1]: Process exited with status 22
2018-04-05T13:49:31.188588+00:00 heroku[web.1]: State changed from starting to crashed
2018-04-05T13:49:31.190801+00:00 heroku[web.1]: State changed from crashed to starting
2018-04-05T13:49:41.680073+00:00 heroku[web.1]: Starting process with command `npm start`
2018-04-05T13:49:44.021163+00:00 app[web.1]:
2018-04-05T13:49:44.021180+00:00 app[web.1]: > check-market#1.0.0 start /app
2018-04-05T13:49:44.021181+00:00 app[web.1]: > node index.js
2018-04-05T13:49:44.021183+00:00 app[web.1]:
2018-04-05T13:49:44.261412+00:00 app[web.1]: Server is running on port 5000
2018-04-05T13:50:24.659139+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=cryptic-hollows-53642.herokuapp.com request_id=19ee5172-d09e-4a14-bec5-7332c5b8b572 fwd="112.134.75.196" dyno= connect= service= status=503 bytes= protocol=https
2018-04-05T13:50:42.173853+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 secondsof launch
2018-04-05T13:50:42.173971+00:00 heroku[web.1]: Stopping process with SIGKILL
2018-04-05T13:50:42.278113+00:00 heroku[web.1]: Process exited with status 137
2018-04-05T13:50:42.292645+00:00 heroku[web.1]: State changed from starting to crashed
2018-04-05T13:50:44.109644+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cryptic-hollows-53642.herokuapp.com request_id=457aceaf-7149-4cd8-aaf0-1e9746c2e7a9 fwd="112.134.75.196" dyno= connect= service= status=503 bytes= protocol=https
2018-04-05T13:50:46.073884+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=cryptic-hollows-53642.herokuapp.com request_id=6d2ed2ed-a2dc-4b77-80f1-099d442e16db fwd="112.134.75.196" dyno= connect= service= status=503 bytes= protocol=https
2018-04-05T13:50:55.112767+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cryptic-hollows-53642.herokuapp.com request_id=51e6ee29-3f28-4dc1-bc69-b58604b6524b fwd="112.134.75.196" dyno= connect= service= status=503 bytes= protocol=https
2018-04-05T13:51:02.307944+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=cryptic-hollows-53642.herokuapp.com request_id=5e366ae1-6d66-4015-85ad-e407316d083f fwd="112.134.75.196" dyno= connect= service= status=503 bytes= protocol=https
2018-04-05T13:51:24.537650+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cryptic-hollows-53642.herokuapp.com request_id=8483caf1-1e99-4735-a16e-8df0d09b3d20 fwd="112.134.75.196" dyno= connect= service= status=503 bytes= protocol=https
2018-04-05T13:51:27.770178+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=cryptic-hollows-53642.herokuapp.com request_id=28e8927c-21ac-44c5-84e5-093f55c95aeb fwd="112.134.75.196" dyno= connect= service= status=503 bytes= protocol=https
As I read in heroku logs, I know there's an issue (as it mentions). But I can't figure out what it is as what I've followed the same steps as before (same as I hosted other apps on Heroku)
Can anyone tell me what have I done wrong ?
P.S :
I've checked this and added Procfile and then I got an issue with React App saying Invalid Header File . So I removed it (as Heroku has made the process automatically sometime after the post)
And I checked with this as well but I don't think it'll be any help.
Try adding the config vars into your heroku app by going through
Your app => Settings => Reveal Config vars => Add PORT 5000 in it
I had the same exact issue, I have added the PORT 5000 as mentioned above, but it alone didn't resolve my issue.
Anyway by checking the build logs, I found the following error:
Error: Configuration property "mongoURI" is not defined
The production.json file was in .gitignore file, and by removing it from .gitignore and pushing it to Heroku the issue was resolved.