feat: refactor the auth condition in Next Auth (#5866)

This upgrade includes two changes:

For users deploying with Vercel using next-auth, it is necessary to add the environment variable `NEXT_PUBLIC_ENABLE_NEXT_AUTH=1` to ensure Next Auth is enabled; other users are not affected.
For users using clerk in self-built images, it is necessary to additionally configure `NEXT_PUBLIC_ENABLE_NEXT_AUTH=0` to disable Next Auth

Other standard deployment scenarios (using Clerk in Vercel and using next-auth in Docker) are not affected

For More detail, refer to https://github.com/lobehub/lobe-chat/issues/5804

本次升级存在两个变更:

- 针对使用 Vercel 部署中使用 next-auth 的用户,需要额外添加 `NEXT_PUBLIC_ENABLE_NEXT_AUTH=1` 环境变量来确保开启 Next Auth
- 针对使用自构建镜像中使用 clerk 的用户,需要额外配置 `NEXT_PUBLIC_ENABLE_NEXT_AUTH=0` 环境变量来关闭 Next Auth

其他标准部署场景(Vercel 中使用 Clerk 与 Docker 中使用 next-auth )不受影响

变更详情原因查看 https://github.com/lobehub/lobe-chat/issues/5804
This commit is contained in:
Arvin Xu
2025-02-08 10:25:28 +08:00
committed by GitHub
parent a1149301a3
commit e529108ff6
26 changed files with 58 additions and 2266 deletions
+1
View File
@@ -179,6 +179,7 @@ const nextConfig: NextConfig = {
],
// when external packages in dev mode with turbopack, this config will lead to bundle error
serverExternalPackages: isProd ? ['@electric-sql/pglite'] : undefined,
transpilePackages: ['pdfjs-dist', 'mermaid'],
webpack(config) {