Giter Site home page Giter Site logo

Comments (3)

filipdjokic avatar filipdjokic commented on September 2, 2024 1

We've also encountered the same timeout error during app initialization with v1.16.0, v1.17.0 and v1.18.0.

After some investigation, we managed to resolve it by adding the connectionTimeout configuration parameter to the createPoolByEnv function:

const createPoolByEnv = async (
  databaseDsn: string,
  mockDatabaseConnection: boolean,
  poolSize?: number,
  connectionTimeout?: number
) => {
  // Database connection is disabled in unit test environment
  if (mockDatabaseConnection) {
    return createMockPool({ query: async () => createMockQueryResult([]) });
  }

  assert(parseDsn(databaseDsn).databaseName, new Error('Database name is required'));

  return createPool(databaseDsn, {
    interceptors: createInterceptorsPreset(),
    maximumPoolSize: poolSize,
    connectionTimeout: connectionTimeout,
  });
};

Additionally, we've added an environment variable named DATABASE_CONNECTION_TIMEOUT, which if unset will have the default value of 10_000 (in our case setting it to 30_000 resolved the issue).
This way, the environment variable will remain optional, allowing people to adjust this setting if needed.

Is this something you would consider including in the next release? Happy to contribute and help with the implementation.

from logto.

charIeszhao avatar charIeszhao commented on September 2, 2024

It seems you have issues connecting to the database. Can you share your config?

from logto.

peteryang1756 avatar peteryang1756 commented on September 2, 2024

It seems you have issues connecting to the database. Can you share your config?

This is my db config
DB_URL=postgres://postgres.woefiqksuduiihlynziwdydegh:[email protected]:6543/postgres

from logto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.