Skip to content

bug: DB Connect Error #6878

Closed
Closed
@chenxv399

Description

@chenxv399

Describe the bug

When deploying logto using docker according to the official documentation, the container reports “timeout expired” and exits abnormally.

Expected behavior

Logto should start successfully and connect to the PostgreSQL database without timing out.

How to reproduce?

The problem started when I wanted to deploy logto via 1panel, and the problem occurred after doing so by default. The container log reported the following error:

> cli
> logto db seed --swe

- Create tables
info ✔ Create tables
info ✔ [default] Generated config oidc.privateKeys
info ✔ [default] Generated config oidc.cookieKeys
info ✔ [default] Seed OIDC config
info ✔ [admin] Generated config oidc.privateKeys
info ✔ [admin] Generated config oidc.cookieKeys
info ✔ [admin] Seed OIDC config
info ✔ Cloud Service Application successfully created for: default
info ✔ Created machine-to-machine applications for Management API proxy
info ✔ Initialized tenant organization template
info ✔ Assigned the proxy roles to the applications
info ✔ Created tenant organizations
info ✔ Seed data
npm notice
npm notice New minor version of npm available! 10.8.2 -> 10.9.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.9.2
npm notice To update run: npm install -g [email protected]
npm notice

> start
> cd packages/core && NODE_ENV=production node .

(node:44) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
index    error Error while initializing app:
index    error Error: timeout expired
    at Timeout._onTimeout (/etc/logto/node_modules/.pnpm/[email protected]/node_modules/pg/lib/client.js:106:28)
    at listOnTimeout (node:internal/timers:581:17)
    at process.processTimers (node:internal/timers:519:7)

After this, I tried to re-deploy according to the official documentation. I tried deploying via docker, deploying via docker-compose, and deploying via npm-init, but the same problem happened in all three cases. I even tried different versions of the database, including pgSQL14, pgSQL16 and pgSQL17 containers, but none of them worked and the same problem happened again.

I then tried the solution provided by others in #6748, but it still didn't work. I also checked #6187 and PR #6674, but I don't seem to understand them very well.

Up to this point, I had exhausted everything I could think of, but the problem remained unsolved.

Context

  • Logto Cloud
  • Self-hosted, Logto version = 1.22.0
    • Container (Docker image)
    • Raw Node.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpending-verificationSomething is still under investigation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions