2 years ago
#58324
nmendez4
App runs locally but crashes when deployed to Heroku (H10)
I'm attempting to post this to Heroku, and have it working locally on my machine, but I keep getting errors and it won't load. I've tried restarting heroku, checking for errors, but have no idea where I'm going wrong or what steps should be taken next.
this is heroku log --tail, and the errors that pop up
2022-01-16T20:19:24.279829+00:00 app[web.1]: (node:22) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2022-01-16T20:19:24.410075+00:00 heroku[web.1]: Process exited with status 0
2022-01-16T20:19:24.473592+00:00 heroku[web.1]: State changed from starting to crashed
2022-01-16T20:19:28.698180+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=obscure-savannah-82381.herokuapp.com request_id=1238eba7-7665-48a5-b7ee-abd45504feb5 fwd="155.37.216.110" dyno= connect= service= status=503 bytes= protocol=https
2022-01-16T20:19:29.679614+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=obscure-savannah-82381.herokuapp.com request_id=322a0424-e2d8-428a-9e47-064a051e3af6 fwd="155.37.216.110" dyno= connect= service= status=503 bytes= protocol=https
2022-01-16T20:27:13.554386+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=obscure-savannah-82381.herokuapp.com request_id=587efe55-b84f-4aeb-9137-29850a4b6f55 fwd="155.37.216.110" dyno= connect= service= status=503 bytes= protocol=https
2022-01-16T20:27:14.863800+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=obscure-savannah-82381.herokuapp.com request_id=2d9a95f9-7aa4-4703-b1f0-6ccd1211f529 fwd="155.37.216.110" dyno= connect= service= status=503 bytes= protocol=https
server.js file
const express = require('express');
const routes = require('./controllers');
const sequelize = require('./config/connection');
const path = require('path');
const helpers = require('./utils/helpers');
const exphbs = require('express-handlebars');
const hbs = exphbs.create({ helpers });
const session = require('express-session');
const app = express();
const PORT = process.env.PORT || 3001;
const SequelizeStore = require('connect-session-sequelize')(session.Store);
const sess = {
secret: 'super duper secret',
cookie: {
expires: 10 * 60 * 1000
},
resave: true,
rolling: true,
saveUninitialized: true,
store: new SequelizeStore({
db: sequelize
}),
};
app.use(session(sess));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(express.static(path.join(__dirname, 'public')));
app.engine('handlebars', hbs.engine);
app.set('view engine', 'handlebars');
app.use(routes);
// turn on connection to database and server
sequelize.sync({ force: false }).then(() => {
app.listen(PORT, () => console.log('Now listening on'));
});
connection.js file
const Sequelize = require('sequelize');
require('dotenv').config();
const sequelize = new Sequelize(process.env.DB_NAME, process.env.DB_USER, process.env.DB_PW, {
host: 'localhost',
dialect: 'mysql',
port: 3306
});
module.exports = sequelize;
node.js
heroku
sequelize.js
connection
heroku-cli
0 Answers
Your Answer