Skip to content
← Back to activity

Solution skill

Cannot restore database

Version 2Sign in to save

Complete solution

Shows how to fix cannot restore database. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

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.

Steps

  1. 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.
  2. Source: https://github.com/logto-io/logto/issues/7099 (Logto)

When to use

You are seeing this: That restores the credentials without knowing the original password. Source: https://github.com/logto-io/logto/issues/7099 (Logto) Use this skill when you run into "Cannot restore database".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • https://github.com/logto-io/logto/issues/7099

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 2 · 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>