diff --git a/docs/self-hosting/advanced/auth/next-auth/logto.mdx b/docs/self-hosting/advanced/auth/next-auth/logto.mdx index 7c9f73ce6b72..549864b6274d 100644 --- a/docs/self-hosting/advanced/auth/next-auth/logto.mdx +++ b/docs/self-hosting/advanced/auth/next-auth/logto.mdx @@ -75,10 +75,32 @@ When deploying LobeChat, you need to configure the following environment variabl Visit [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#logto) for details on related variables. - + +### Troubleshooting + +If you encounter issues during the Logto deployment process, refer to the following common problems: + +- `Only roles with the xxx attribute may create roles`: +Check your database user's permissions and ensure that the user in your Logto database has the `admin` role to create roles. + +- Error executing `logto db seed` on third-party databases like `Neon`: +Try using the `logto db seed --encrypt-base-role` command. + +- Database seeding failed: +Try skipping the seeding process with the `--skip-seed` parameter. + +- `Error: role xxx already exists`: +Delete the existing role in the database. + +- Database migration failed after a version upgrade: +Try using the command `npx @logto/cli db alteration deploy $version` (e.g., `npx @logto/cli db alteration deploy 1.22.0`). + +- I am using Docker deployment and want a one-click upgrade: +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` + After successful deployment, users will be able to authenticate via Logto and use LobeChat. diff --git a/docs/self-hosting/advanced/auth/next-auth/logto.zh-CN.mdx b/docs/self-hosting/advanced/auth/next-auth/logto.zh-CN.mdx index cab4ee751b51..a97d2031a118 100644 --- a/docs/self-hosting/advanced/auth/next-auth/logto.zh-CN.mdx +++ b/docs/self-hosting/advanced/auth/next-auth/logto.zh-CN.mdx @@ -72,8 +72,30 @@ tags: 前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#logto) 可查阅相关变量详情。 - + +### 故障排除 + +若你在部署 Logto 过程中遇到问题,可以参考以下常见问题: + +- `Only roles with the xxx attribute may create roles`: +请检查你的数据库用户权限,确保你的 Logto 数据库中的用户具有 `admin` 角色,以便创建角色。 + +- 在第三方数据库例如 `Neon` 上执行`logto db seed`出错: +尝试使用`logto db seed --encrypt-base-role`命令。 + +- 数据库播种失败: +请尝试使用`--skip-seed`参数跳过播种。 + +- `Error: role xxx already exists`: +在数据库中删除已存在的角色即可。 + +- 版本升级后,数据库迁移失败: +请尝试使用` npx @logto/cli db alteration deploy $version`命令(例如`npx @logto/cli db alteration deploy 1.22.0`) + +- 我使用 docker 部署 希望一键升级: +在容器中执行自定义命令:`sh -c "npm run cli db seed -- --swe --encrypt-base-role" && npx @logto/cli db alteration deploy $version && npm start` + 部署成功后,用户将可以通过 Logto 身份认证并使用 LobeChat。