lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
40.95k stars 9.34k forks source link

[Bug] Authentik Middleware #2088

Closed shigomany closed 4 months ago

shigomany commented 5 months ago

💻 Operating System

Ubuntu

📦 Environment

Docker

🌐 Browser

Other

🐛 Bug Description

When I provided all the information on authentic, when trying to communicate with AI, I do not see a window that requires authorization through Authentick. And the following errors appear in the console:

[auth][error] UnknownAction: Cannot parse action at /session .Read more at https://errors.authjs.dev#unknownaction
    at /app/.next/server/src/middleware.js:13:74574
    at r5 (/app/.next/server/src/middleware.js:13:74892)
    at o8 (/app/.next/server/src/middleware.js:369:46269)
    at af (/app/.next/server/src/middleware.js:369:55910)
    at ay (/app/.next/server/src/middleware.js:369:57261)
    at Object.r [as handler] (/app/.next/server/src/middleware.js:369:56930)
    at /app/.next/server/src/middleware.js:13:23516
    at AsyncLocalStorage.run (node:async_hooks:346:14)
    at Object.wrap (/app/.next/server/src/middleware.js:13:15290)
    at /app/.next/server/src/middleware.js:13:23329

🚦 Expected Behavior

A window appears that you need to log in

📷 Recurrence Steps

Deploy via docker with provided variables:

File: .env:

# openssl rand -base64 32
NEXTAUTH_SECRET="****"

# SSO
ENABLE_OAUTH_SSO=1
SSO_PROVIDERS="authentik"
AUTHENTIK_CLIENT_ID="****"
AUTHENTIK_CLIENT_SECRET="****"
AUTHENTIK_ISSUER="https://authentik.mysite.com/application/o/ai/"
NEXTAUTH_URL="https://ai.mysite.com"

# MODELS
ANTHROPIC_API_KEY="sk-****"
OPENAI_API_KEY="sk-****"

File docker-compose.yaml:

services:
  lobe-chat:
    image: lobehub/lobe-chat
    container_name: lobe-chat
    restart: always
    ports:
      - '3210:3210'
    env_file:
      - .env

📝 Additional Information

Docker version: Docker version 26.0.0, build 2ae903e Lobe chat: v0.147.18

lobehubbot commented 5 months ago

👀 @shigomany

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

arvinxx commented 5 months ago

@RealTong hi, please help to check it

RealTong commented 5 months ago

@shigomany

You need to add the ACCESS_CODE environment variable. You can generate this value using uuidgen or by visiting the online website https://www.uuidgenerator.net/.

shigomany commented 5 months ago

@RealTong Yes, a window with an access code now appears. But if I enter it, then authorization via SSO does not require anyway) Authorization via SSO is just so necessary, it does not protect anything) And recently, access code has become optional

And error in console log exists:

[auth][error] UnknownAction: Cannot parse action at /session .Read more at https://errors.authjs.dev#unknownaction
    at /app/.next/server/src/middleware.js:13:74574
    at r5 (/app/.next/server/src/middleware.js:13:74892)
    at o8 (/app/.next/server/src/middleware.js:369:46269)
    at af (/app/.next/server/src/middleware.js:369:55910)
    at ay (/app/.next/server/src/middleware.js:369:57261)
    at Object.r [as handler] (/app/.next/server/src/middleware.js:369:56930)
    at /app/.next/server/src/middleware.js:13:23516
    at AsyncLocalStorage.run (node:async_hooks:346:14)
    at Object.wrap (/app/.next/server/src/middleware.js:13:15290)
    at /app/.next/server/src/middleware.js:13:23329
lobehubbot commented 4 months ago

👋 @{{ author }}
Since the issue was labeled with 🤔 Need Reproduce, but no response in 3 days. This issue will be closed. If you have any questions, you can comment and reply.\ 由于该 issue 被标记为需要更多信息,却 3 天未收到回应。现关闭 issue,若有任何问题,可评论回复。

lobehubbot commented 4 months ago

✅ @shigomany

This issue is closed, If you have any questions, you can comment and reply.\ 此问题已经关闭。如果您有任何问题,可以留言并回复。

arnabk commented 3 months ago

I am getting the exact same error. I followed this documentation https://lobehub.com/docs/self-hosting/advanced/sso-providers/auth0

What was the resolution?

shigomany commented 3 months ago

This bug is not fixed because this bug was not well publicized.