When i open heroku i have a problem with strapi with h10 code

System Information
  • Strapi Version: 0.1.0
  • Operating System: windows
  • Database: postgress
  • Node Version: 10.24.0
  • NPM Version: 6.0.0
  • Yarn Version:

on local machine the strapi app backend api is working fine but on the Heroku server I’m getting
at=error code=H10 desc="App crashed"

and while inspecting on console i’m getting

hairsalon.herokuapp.com/:1 GET https://hairsalon.herokuapp.com/ 503 (Service Unavailable)
favicon.ico:1 GET https://hairsalon.herokuapp.com/favicon.ico 503 (Service Unavailable) 

I tried to solve but couldn’t find a way. I found a similar post on stackoverflow mentioning about the same error link: app crashed

Try this https://forum.strapi.io/t/error-no-pg-hba-conf-entry-for-host-ssl-off/3409

#solved

thanks to Antoine

I just added self assigned ssl code from strapi docs and it works

follow below steps

add below code in database.js file

   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 

``` // localhost

// module.exports = ({ env }) => ({
//   defaultConnection: 'default',
//   connections: {
//     default: {
//       connector: 'bookshelf',
//       settings: {
//         client: 'sqlite',
//         filename: env('DATABASE_FILENAME', '.tmp/data.db'),
//       },
//       options: {
//         useNullAsDefault: true,
//       },
//     },
//   },
// });

// production

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'),
    },
  },
});```