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

New version change of behaviour, Integresql is not waiting for DB to finish creating #17

Open
bartoszhernas opened this issue Feb 9, 2024 · 2 comments

Comments

@bartoszhernas
Copy link

Hi, after we upgraded to newest IntegreSQL we noticed tests started failing randomly with error that the DB we try to use doesn't exist.

I pinpointed the issue to query creating DB in PostgreSQL and not waiting for it to finish, while the client libraries would continue executing and trying to not (yet) existing DB.

postgres-1  | 2024-02-09 12:18:27.531 UTC [3827] LOG:  statement: CREATE DATABASE "integresql_test_00bd369da024925dba2efdb4ce82cffc421b349d_020" WITH OWNER "fym" TEMPLATE "integresql_template_00bd369da024925dba2efdb4ce82cffc421b349d"
postgres-1  | 2024-02-09 12:18:27.531 UTC [3833] FATAL:  database "integresql_test_00bd369da024925dba2efdb4ce82cffc421b349d_020" does not exist
postgres-1  | 2024-02-09 12:18:27.531 UTC [3833] DETAIL:  It seems to have just been dropped or renamed.

It was working just fine with previous version, so I am guessing there was some change in IntegreSQL?

The fix for us right now was to try to connect to DB multiple times until it works

  let retriesConnectMain = 0;
  while (retriesConnectMain < 10) {
    try {
      // eslint-disable-next-line no-await-in-loop
      await prismaMain.$connect();
      break;
    } catch (e) {
      retriesConnectMain += 1;
      // eslint-disable-next-line no-await-in-loop
      await wait(100);
    }
  }
@Shaddix
Copy link
Contributor

Shaddix commented Mar 5, 2024

Experienced the same thing in CI builds on Azure DevOps after upgrading (tests were running fine on v1.0, but are not finding the DB in v1.1).
Running tests locally worked for me, though

@christophsturm
Copy link

is this library still maintained? I'm running into a variation of this bug.

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