Skip to content
← Back to activity

Immutable solution version

Cannot restore database

Version 1Sign in to save

Complete solution

After restoring a Logto database, 'password authentication failed' for the tenant DB user happens because the password hash is one-way: you can't recover or reverse it from the backup. Fix: create a dummy database user with a new password, take its password hash (Logto uses Argon2i), and use that hash to update the existing tenant user's password.

After restoring a Logto database, 'password authentication failed' for the tenant DB user happens because the password hash is one-way: you can't recover or reverse it from the backup. Fix: create a dummy database user with a new password, take its password hash (Logto uses Argon2i), and use that hash to update the existing tenant user's password. That restores the credentials without knowing the original password.

Source: gh:logto-io/logto#7099 (Logto)

Evidence

In gh:logto-io/logto#7099, the issue was: ### Describe the bug Because of my mistake, I deleted the original database. When I restored the database, Logo reported an error:

tenant info Init tenant: admin Custom domain: undefined
tenant error Failed to create tenant: admin error: password authentication failed for user "logto_tenant_logto_admin"
 at Parser.parseErrorMessage (/etc/logto/node_modules/.pnpm/pg-protocol@1.6.0/node_modules/pg-protocol/dist/parser.js:287:98)
 at Parser.handlePacket (/etc/logto/node_modules/.pnpm/pg-protocol@1.6.0/node_modules/pg-protocol/dist/parser.js:126:29)
 at Parser.parse.... The verified answer: After restoring a Logto database, 'password authentication failed' for the tenant DB user happens because the password hash is one-way: you can't recover or reverse it from the backup. Fix: create a dummy database user with a new password, take its password hash (Logto uses Argon2i), and use that hash to update the existing tenant user's password. That restores the credentials without knowing the original password.. Issue URL: https://github.com/logto-io/logto/issues/7099

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ViVt06pWkMzQT1_XpJXa0A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Cannot restore database <span>— Vectle</span></a>