Skip to content

Commit decd129

Browse files
authored
📝 docs: add troubleshooting for logto (lobehub#5114)
1 parent 9159ab3 commit decd129

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

docs/self-hosting/advanced/auth/next-auth/logto.mdx

+23-1
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,32 @@ When deploying LobeChat, you need to configure the following environment variabl
7575

7676
<Callout type={'tip'}>
7777
Visit [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#logto) for details on related variables.
78-
78+
7979
</Callout>
8080
</Steps>
8181

82+
### Troubleshooting
83+
84+
If you encounter issues during the Logto deployment process, refer to the following common problems:
85+
86+
- `Only roles with the xxx attribute may create roles`:
87+
Check your database user's permissions and ensure that the user in your Logto database has the `admin` role to create roles.
88+
89+
- Error executing `logto db seed` on third-party databases like `Neon`:
90+
Try using the `logto db seed --encrypt-base-role` command.
91+
92+
- Database seeding failed:
93+
Try skipping the seeding process with the `--skip-seed` parameter.
94+
95+
- `Error: role xxx already exists`:
96+
Delete the existing role in the database.
97+
98+
- Database migration failed after a version upgrade:
99+
Try using the command `npx @logto/cli db alteration deploy $version` (e.g., `npx @logto/cli db alteration deploy 1.22.0`).
100+
101+
- I am using Docker deployment and want a one-click upgrade:
102+
Execute the custom command in the container: `sh -c "npm run cli db seed -- --swe --encrypt-base-role" && npx @logto/cli db alteration deploy $version && npm start`
103+
82104
<Callout type={'info'}>
83105
After successful deployment, users will be able to authenticate via Logto and use LobeChat.
84106
</Callout>

docs/self-hosting/advanced/auth/next-auth/logto.zh-CN.mdx

+23-1
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,30 @@ tags:
7272

7373
<Callout type={'tip'}>
7474
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#logto) 可查阅相关变量详情。
75-
75+
7676
</Callout>
7777
</Steps>
7878

79+
### 故障排除
80+
81+
若你在部署 Logto 过程中遇到问题,可以参考以下常见问题:
82+
83+
- `Only roles with the xxx attribute may create roles`
84+
请检查你的数据库用户权限,确保你的 Logto 数据库中的用户具有 `admin` 角色,以便创建角色。
85+
86+
- 在第三方数据库例如 `Neon` 上执行`logto db seed`出错:
87+
尝试使用`logto db seed --encrypt-base-role`命令。
88+
89+
- 数据库播种失败:
90+
请尝试使用`--skip-seed`参数跳过播种。
91+
92+
- `Error: role xxx already exists`
93+
在数据库中删除已存在的角色即可。
94+
95+
- 版本升级后,数据库迁移失败:
96+
请尝试使用` npx @logto/cli db alteration deploy $version`命令(例如`npx @logto/cli db alteration deploy 1.22.0`)
97+
98+
- 我使用 docker 部署 希望一键升级:
99+
在容器中执行自定义命令:`sh -c "npm run cli db seed -- --swe --encrypt-base-role" && npx @logto/cli db alteration deploy $version && npm start`
100+
79101
<Callout type={'info'}>部署成功后,用户将可以通过 Logto 身份认证并使用 LobeChat。</Callout>

0 commit comments

Comments
 (0)