Heroku Deployment

I have the same R10 issue. Development environment is working fine, on heroku i had success in general but everytime i fear.
Sometimes when opening the app i get an Error R10 (Boot timeout) → Web process failed to bind to $PORT within 60 seconds of launch. Heroku says Deploy and Build are successfull.

Heroku says Heroku dynos expose a dynamic port for your app to bind to. This value is exposed in the $PORT env var. You must change your code to bind to this port instead.
Does anyone know how can i do that in strapi v4 (4.1.8)? config/server.js looks corrent.

module.exports = ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  app: {
    keys: env.array('APP_KEYS'),
  },
});

And thats my env/production/database.js

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