0

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

And my procfile i dont know it´s ok

web: node config/environments/production/server.json

4
  • Can you share your heroku run printenv and your Procfile ? Commented May 5, 2020 at 14:04
  • Yes i edit the post and share printenv and procfile Commented May 5, 2020 at 16:03
  • I strongly recommend you to delete the postgres database(if its empty or dummy one) in heroku. If not at-least change the password. Looks like you have pasted all the valid credentials here.. Commented May 5, 2020 at 16:18
  • Your Procfile should be like web: node strapi start Commented May 5, 2020 at 16:21

3 Answers 3

1

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'),
        },
    },
});
Sign up to request clarification or add additional context in comments.

Comments

0

https://strapi.io/documentation/3.0.0-beta.x/migration-guide/migration-guide-beta.19-to-beta.19.4.html#listened-host-changed

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)

1 Comment

This is my server.json in production. I make follow the instructions and the server.json its same, i delete cache and make build and git push heroku master but i have the same error. { "host": "${process.env.HOST || '0.0.0.0'}", "port": "${process.env.PORT || 1337}", "production": true, "proxy": { "enabled": false }, "cron": { "enabled": false }, "admin": { "autoOpen": false } }
0

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),
          },

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.