Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Knex: Timeout acquiring a connection. Server wasn't able to start properly. #8952

Closed
jieliu218 opened this issue Dec 19, 2020 · 4 comments
Closed

Comments

@jieliu218
Copy link

Bug report

Describe the bug

0|strapi | [2020-12-19T22:56:19.076Z] debug ⛔️ Server wasn't able to start properly.
0|strapi | [2020-12-19T22:56:19.080Z] error KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
0|strapi | at Client_PG.acquireConnection (/home/ubuntu/strapi/node_modules/knex/lib/client.js:348:26)

Steps to reproduce the behavior

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Code snippets

If applicable, add code samples to help explain your problem.

System

  • Node.js version:
  • NPM version:
  • Strapi version:
  • Database:
  • Operating system:

Additional context

Add any other context about the problem here.

@derrickmehaffy
Copy link
Member

This is a templated message

Hello, please follow the issue template.

A proper issue submission let's us better understand the origin of your bug and therefore help you.

I will reopen your issue when we receive the issue following the template guidelines and properly fill out the template. You can see the template guidelines for bug reports here.

Please update the issue with the template and we can reopen this report.

Thank you.

@derrickmehaffy
Copy link
Member

This issue has been mentioned on Strapi Community Forum. There might be relevant details there:

https://forum.strapi.io/t/heroku-error-knextimeouterror-knex-timeout-acquiring-a-connection-the-pool-is-probably-full-are-you-missing-a-transacting-trx-call/2618/2

@w3cj
Copy link

w3cj commented Feb 22, 2021

For anyone else that comes across this error while attempting to deploy to heroku, here is how I fixed it.

I added the line ssl: { rejectUnauthorized: false } to the database connection settings.

It looks like the official strapi documentation now includes this, but I was attempting to deploy a legacy application that did not have this config. https://strapi.io/documentation/developer-docs/latest/concepts/configurations.html#example

return {
  connections: {
    default: {
      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', 'strapi'),
        password: env('DATABASE_PASSWORD', 'strapi'),
        schema: 'public',
        ssl: { rejectUnauthorized: false }, // this line is required
      },
    }
  }
}

@derrickmehaffy
Copy link
Member

It always kind of existed but was never documented (since it comes from Knex and not Strapi itself) but yes I added this to the documentation a while ago 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants