Hi
I just uploaded my first strapi app in heroku. But its not opening and showing some crash report.
My doubt is this two file server.js and database.js
module.exports = ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
url: env('MY_HEROKU_URL'),
app: {
keys: env.array('APP_KEYS'),
},
});
const parse = require('pg-connection-string').parse;
const config = parse(process.env.DATABASE_URL);
module.exports = ({ env }) => ({
connection: {
client: 'postgres',
connection: {
host: config.host,
port: config.port,
database: config.database,
user: config.user,
password: config.password,
ssl: {
rejectUnauthorized: false
},
},
debug: false,
},
});
2022-03-22T08:54:31.749206+00:00 heroku[web.1]: State changed from crashed to starting
2022-03-22T08:54:40.745176+00:00 heroku[web.1]: Starting process with command `npm start`
2022-03-22T08:54:42.000000+00:00 app[api]: Build succeeded
2022-03-22T08:54:42.012304+00:00 app[web.1]:
2022-03-22T08:54:42.012373+00:00 app[web.1]: > my-app@0.1.0 start
2022-03-22T08:54:42.012377+00:00 app[web.1]: > strapi start
2022-03-22T08:54:42.012378+00:00 app[web.1]:
2022-03-22T08:54:43.738910+00:00 app[web.1]: [2022-03-22 08:54:43.737] debug: ⛔️ Server wasn't able to start properly.
2022-03-22T08:54:43.740060+00:00 app[web.1]: [2022-03-22 08:54:43.739] error: Middleware "strapi::session": App keys are required. Please set app.keys in config/server.js (ex: keys: ['myKeyA', 'myKeyB'])
2022-03-22T08:54:43.740062+00:00 app[web.1]: Error: Middleware "strapi::session": App keys are required. Please set app.keys in config/server.js (ex: keys: ['myKeyA', 'myKeyB'])
2022-03-22T08:54:43.740063+00:00 app[web.1]: at instantiateMiddleware (/app/node_modules/@strapi/strapi/lib/services/server/middleware.js:12:11)
2022-03-22T08:54:43.740063+00:00 app[web.1]: at resolveMiddlewares (/app/node_modules/@strapi/strapi/lib/services/server/middleware.js:56:18)
2022-03-22T08:54:43.740064+00:00 app[web.1]: at registerApplicationMiddlewares (/app/node_modules/@strapi/strapi/lib/services/server/register-middlewares.js:66:29)
2022-03-22T08:54:43.740065+00:00 app[web.1]: at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-03-22T08:54:43.740065+00:00 app[web.1]: at async Object.initMiddlewares (/app/node_modules/@strapi/strapi/lib/services/server/index.js:99:7)
2022-03-22T08:54:43.740078+00:00 app[web.1]: at async Strapi.bootstrap (/app/node_modules/@strapi/strapi/lib/Strapi.js:401:5)
2022-03-22T08:54:43.740078+00:00 app[web.1]: at async Strapi.load (/app/node_modules/@strapi/strapi/lib/Strapi.js:413:5)
2022-03-22T08:54:43.740078+00:00 app[web.1]: at async Strapi.start (/app/node_modules/@strapi/strapi/lib/Strapi.js:161:9)
2022-03-22T08:54:43.962662+00:00 heroku[web.1]: Process exited with status 1
2022-03-22T08:54:44.017777+00:00 heroku[web.1]: State changed from starting to crashed
2022-03-22T08:55:18.700991+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=strapitesting1.herokuapp.com request_id=e7edec6e-72c3-4511-be5f-72f0daf38321 fwd="103.48.197.158" dyno= connect= service= status=503 bytes= protocol=https
2022-03-22T08:55:19.490635+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=strapitesting1.herokuapp.com request_id=02ded88c-4ab6-4e48-a584-a6a7b70425e2 fwd="103.48.197.158" dyno= connect= service= status=503 bytes= protocol=https