Error with backstage with single postgres database and schemas

See original GitHub issue

Hello, we are having an issue.

We have a database named “backstage_db” without access to “postgres” database in GCP.

And we also need to use pluginDivisionMode: schema and not create new databases.

Our app-config.yaml is following:

  database:
    # config options: https://node-postgres.com/api/client
    client: pg
    connection:
      host: db
      port: 5432
      user: backstage_user
      password: backstage_password
      database: backstage_db
    ensureExists: false
    pluginDivisionMode: schema
    plugin:
      catalog:
        connection:
          database: backstage_db
      auth:
        connection:
          database: backstage_db
      app:
        connection:
          database: backstage_db
      scaffolder:
        connection:
          database: backstage_db

Backstage seems to connect to the database but is probably not creating schemas in our database and we are getting the error:

Backend failed to start up, Error: Failed to connect to the database to make sure that schema for plugin ‘scaffolder’ exists, KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?

Thanks for any help.

Expected Behavior

Backstage should create schemas in our DB

Steps to Reproduce

It works locally, in a docker container, but in the GCP cluster it seems to have a problem.

Context

We tried different versions of backstage, currenlty on "version": "1.2.0-next.2".

The app is running in a docker container.

Even the local instance of backstage is running without the “postgres” database.

Your Environment

  • Local output of yarn backstage-cli info:
OS:   Linux 5.14.18-100.fc33.x86_64 - linux/x64
node: v16.14.0
yarn: 1.22.17
cli:  0.17.1-next.2 (installed)

Dependencies:
  @backstage/app-defaults                    1.0.2-next.0
  @backstage/backend-common                  0.13.3-next.2
  @backstage/backend-tasks                   0.3.1-next.1
  @backstage/catalog-client                  1.0.2-next.0
  @backstage/catalog-model                   1.0.2-next.0
  @backstage/cli-common                      0.1.9-next.0
  @backstage/cli                             0.17.1-next.2
  @backstage/config-loader                   1.1.1-next.1
  @backstage/config                          1.0.1-next.0
  @backstage/core-app-api                    1.0.2-next.1
  @backstage/core-components                 0.9.4-next.1
  @backstage/core-plugin-api                 1.0.2-next.1
  @backstage/errors                          1.0.0
  @backstage/integration-react               1.1.0-next.2
  @backstage/integration                     1.2.0-next.1
  @backstage/plugin-api-docs                 0.8.5-next.2
  @backstage/plugin-app-backend              0.3.32-next.1
  @backstage/plugin-auth-backend             0.13.1-next.2
  @backstage/plugin-auth-node                0.2.1-next.1
  @backstage/plugin-catalog-backend          1.1.2-next.2
  @backstage/plugin-catalog-common           1.0.2-next.0
  @backstage/plugin-catalog-graph            0.2.17-next.2
  @backstage/plugin-catalog-import           0.8.8-next.2
  @backstage/plugin-catalog-react            1.1.0-next.2
  @backstage/plugin-catalog                  1.2.0-next.2
  @backstage/plugin-github-actions           0.5.5-next.2
  @backstage/plugin-org                      0.5.5-next.2
  @backstage/plugin-permission-common        0.6.1-next.0
  @backstage/plugin-permission-node          0.6.1-next.1
  @backstage/plugin-permission-react         0.4.1-next.1
  @backstage/plugin-proxy-backend            0.2.26-next.1
  @backstage/plugin-scaffolder-backend       1.2.0-next.1
  @backstage/plugin-scaffolder-common        1.1.0-next.0
  @backstage/plugin-scaffolder               1.2.0-next.2
  @backstage/plugin-search-backend-module-pg 0.3.3-next.1
  @backstage/plugin-search-backend-node      0.6.1-next.1
  @backstage/plugin-search-backend           0.5.2-next.1
  @backstage/plugin-search-common            0.3.4-next.0
  @backstage/plugin-search-react             0.2.0-next.2
  @backstage/plugin-search                   0.8.1-next.2
  @backstage/plugin-tech-radar               0.5.12-next.0
  @backstage/plugin-techdocs-backend         1.1.1-next.1
  @backstage/plugin-techdocs-node            1.1.1-next.1
  @backstage/plugin-techdocs-react           0.1.1-next.2
  @backstage/plugin-techdocs                 1.1.1-next.2
  @backstage/plugin-user-settings            0.4.4-next.0
  @backstage/release-manifests               0.0.3-next.0
  @backstage/search-common                   0.3.4-next.0
  @backstage/test-utils                      1.1.0-next.2
  @backstage/theme                           0.2.15
  @backstage/types                           1.0.0
  @backstage/version-bridge                  1.0.1

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
MikeSamvcommented, Oct 24, 2022

@Hanyman8 Hey, I’m having the same issue as you. Can you by any chance give more info about how you changed the connection pool from session to transaction? Thanks

0reactions
Hanyman8commented, Jun 8, 2022

Hello, we changed our connection pool (switched from session to transaction and updated connection pool) and it is working now, thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring Plugin Databases - Backstage.io
Guide on how to configure Backstage databases. ... If you intend to use both PostgreSQL and SQLite, you can install both of them....
Read more >
Unable to deploy backstage on GKE cluster with CloudSQL ...
I've tried to run the docker image locally and was successful. I am stuck running the deployment with the cloudsql postgres database ......
Read more >
Documentation: 15: CREATE DATABASE - PostgreSQL
Errors along the line of “could not initialize database directory” are most likely related to insufficient permissions on the data directory, a full...
Read more >
Schema for table not up to date" - KB75768149: BackStage ...
These errors appear when the BackStage Databases are owned by "dbo" who is an "sa" user. Change the owner of the BackStage Databases...
Read more >
PostgreSQL Repository - ForgeRock Backstage
The path/to/openidm/db/postgresql/scripts/createuser.pgsql script creates an openidm database and role, with a default password of openidm . The script also ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found