documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Following AWS Deploy from Strapi Doc get Error

Open wanbinkimoon opened this issue 3 years ago • 5 comments

Bug report

Describe the bug

Everything went fine till point 6. Link

Reaching that point I get this error

error KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?

Surfing the issues on this repo I added pool options to my config/database.js like follows

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", ""),
      },
      options: {
        ssl: false,
        pool: {
          min: 0,
          max: 100,
          idleTimeoutMillis: 60000,
          createTimeoutMillis: 60000,
          acquireTimeoutMillis: 60000,
        },
      },
    },
  },
});

A clear and concise description of what the bug is.

Steps to reproduce the behavior

  1. Follow the docs till point 6
  2. Run command pm2 start ecosystem.config.js
  3. See error

Expected behavior

Strapi server starts

Screenshots

Screenshot 2021-05-27 at 17 35 23

wanbinkimoon avatar May 27 '21 15:05 wanbinkimoon

What size Database (and type) and can you connect to the database from the commandline using a CLI db client (like mysql or psql?)

derrickmehaffy avatar May 27 '21 17:05 derrickmehaffy

FIxed changing inbound rules to allow TCP/IP connections: please update documentation adding a step in RDS DB creation

wanbinkimoon avatar May 28 '21 07:05 wanbinkimoon

Hi - I am also experiencing this same error. Can't figure out any solution. @wanbinkimoon how did you add the inbound rules to allow TCP/IP? Thanks

erik-valtechsd avatar Jun 01 '21 15:06 erik-valtechsd

@erik-valtechsd in the RDS Db instance page there is a Securuty tab there you can edit which TCP/IP connections are allowed or not

also max pool allowed is 15 so my code changed as follows

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", ""),
      },
      options: {
        ssl: false,
        pool: {
          min: 0,
          max: 15, // <---- here max is 15
          idleTimeoutMillis: 60000,
          createTimeoutMillis: 60000,
          acquireTimeoutMillis: 60000,
        },
      },
    },
  },
});

wanbinkimoon avatar Jun 03 '21 09:06 wanbinkimoon

We plan to refactor the deployment docs soon, going to transfer this issue to our docs repo.

derrickmehaffy avatar Jun 16 '21 22:06 derrickmehaffy

Hello. I'm sorry that you were having troubles and that this issue didn't get more attention sooner. I'm cleaning up old documentation issues and I will close this issue now. Feel free to open a new issue if you're still having trouble with the documentation for Strapi v4.11+.

pwizla avatar Jul 10 '23 15:07 pwizla