Reputation: 3
i have this problem when i open heroku and run heroku logs --tail The app crashed and dont see my app strapi in heroku.................
2020-05-04T19:05:38.602418+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=strapi-inmobiliaria-gatsby.herokuapp.com request_id=2b5c1e98-7aaf-4362-905f-bf0e17391fe0 fwd="190.244.81.129" dyno= connect= service= status=503 bytes= protocol=https
2020-05-04T19:05:38.862307+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=strapi-inmobiliaria-gatsby.herokuapp.com request_id=629c8bb2-8e68-4b8d-8d35-919c95130eb2 fwd="190.244.81.129" dyno= connect= service= status=503 bytes= protocol=https
2020-05-04T19:13:18.189908+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=strapi-inmobiliaria-gatsby.herokuapp.com request_id=cd2366d2-1851-4ed2-bf70-72d8db61c1c4 fwd="190.244.81.129" dyno= connect= service= status=503 bytes= protocol=https
2020-05-04T19:13:18.538292+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=strapi-inmobiliaria-gatsby.herokuapp.com request_id=c757b34d-7944-4a5b-944b-ae0dcb84affc fwd="190.244.81.129" dyno= connect= service= status=503 bytes= protocol=https
I search the problem but i no sure what it is.
Its my package.json
{
"name": "bienesraices",
"private": true,
"version": "0.1.0",
"description": "A Strapi application",
"scripts": {
"develop": "strapi develop",
"start": "strapi start",
"build": "strapi build",
"strapi": "strapi"
},
"devDependencies": {},
"dependencies": {
"knex": "<0.20.0",
"mysql": "latest",
"pg": "^8.0.3",
"strapi": "3.0.0-beta.20.1",
"strapi-admin": "3.0.0-beta.20.1",
"strapi-connector-bookshelf": "3.0.0-beta.20.1",
"strapi-plugin-content-manager": "3.0.0-beta.20.1",
"strapi-plugin-content-type-builder": "3.0.0-beta.20.1",
"strapi-plugin-email": "3.0.0-beta.20.1",
"strapi-plugin-graphql": "^3.0.0-beta.20.1",
"strapi-plugin-upload": "3.0.0-beta.20.1",
"strapi-plugin-users-permissions": "3.0.0-beta.20.1",
"strapi-utils": "3.0.0-beta.20.1"
},
"author": {
"name": "A Strapi developer"
},
"strapi": {
"uuid": "13a8b7a9-81dc-4560-98f1-0ec0ec1769c0"
},
"engines": {
"node": ">=10.0.0",
"npm": ">=6.0.0"
},
"license": "MIT"
}
Running printenv on ⬢ strapi-inmobiliaria-gatsby... up, run.3613 (Free)
NODE_HOME=/app/.heroku/node
NODE_ENV=production
WEB_MEMORY=512
DYNO=run.3613
PWD=/app
LINES=30
HOME=/app
DATABASE_PORT=5432
NODE_MODULES_CACHE=false
DATABASE_URL=postgres://cbf************:d0******************************@ec2-52******40.compute-1.amazonaws.com:5432/d3******ntmu
PORT=42473
MEMORY_AVAILABLE=512
DATABASE_NAME=d3************mu
COLUMNS=120
DATABASE_USERNAME=cbf******
WEB_CONCURRENCY=1
SHLVL=1
PATH=/app/.heroku/node/bin:/app/.heroku/yarn/bin:/usr/local/bin:/usr/bin:/bin:/app/bin:/app/node_modules/.bin
web: node config/environments/production/server.json
Upvotes: 0
Views: 1999
Reputation: 495
added this too and it's working now..
ssl: {
rejectUnauthorized: env.bool('DATABASE_SSL_SELF', false), // For self-signed certificates
},
},
options: {
ssl: env.bool('DATABASE_SSL', false),
},
Upvotes: 0
Reputation: 67
I just added self assigned SSL object from strapi docs and it works. Add the rows into database.js
file by follow below steps.
ssl: {
rejectUnauthorized: env.bool('DATABASE_SSL_SELF', false), // For self-signed certificates
},
options: {
ssl: env.bool('DATABASE_SSL', false),
}, `
Complete database.js
file looks like
module.exports = ({
env
}) => ({
defaultConnection: 'default',
connections: {
default: {
connector: 'bookshelf',
settings: {
client: 'postgres',
host: env('DATABASE_HOST', '127.0.0.1'),
port: env.int('DATABASE_PORT', 5432),
database: env('DATABASE_NAME', 'strapi'),
username: env('DATABASE_USERNAME', ''),
password: env('DATABASE_PASSWORD', ''),
//add this line
ssl: {
rejectUnauthorized: env.bool('DATABASE_SSL_SELF', false), // For self-signed certificates
},
},
// add this line
options: {
ssl: env.bool('DATABASE_SSL', false),
},
},
},
});
And my server.js
file looks like
module.exports = ({
env
}) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
admin: {
auth: {
secret: env('ADMIN_JWT_SECRET', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'),
},
},
});
Upvotes: 1
Reputation: 845
Because Heroku is expecting Strapi to be running on a publicly accessible port you need to set the host
variable in config/environments/*/server.json
to use 0.0.0.0
instead of localhost.
(The Strapi Heroku guide is not up to date yet)
Upvotes: 0