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
41.16k stars 9.37k forks source link

[Bug] glm-4v-plus的api调用异常 #3814

Closed BiFangKNT closed 2 weeks ago

BiFangKNT commented 2 weeks ago

📦 部署环境

Docker

📌 软件版本

lobehub/lobe-chat-database:latest

💻 系统环境

Other Linux

🌐 浏览器

Chrome

🐛 问题描述

使用glm-4v-plus模型时,上传图片后模型无法正常回答,报以下错误:

{
  "error": {
    "code": "1210",
    "message": "API 调用参数有误,请检查文档。"
  },
  "endpoint": "https://open.bigmodel.cn/api/paas/v4",
  "provider": "zhipu"
}

📷 复现步骤

选择glm-4v-plus模型,上传图片,询问

🚦 期望结果

正常读取图片,正常回答

📝 补充信息

No response

lobehubbot commented 2 weeks ago

👀 @BiFangKNT

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。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

lobehubbot commented 2 weeks ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


📦 Deployment environment

Docker

📌 Software version

latest

💻 System environment

Other Linux

🌐 Browser

Chrome

🐛 Problem description

When using the glm-4v-plus model, the model cannot answer normally after uploading images and reports the following error:

{
  "error": {
    "code": "1210",
    "message": "The API call parameters are incorrect, please check the documentation."
  },
  "endpoint": "https://open.bigmodel.cn/api/paas/v4",
  "provider": "zhipu"
}

📷 Steps to reproduce

Select the glm-4v-plus model, upload pictures, and ask

🚦 Expected results

Read pictures normally and answer normally

📝 Supplementary information

No response

BiFangKNT commented 2 weeks ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

📦 Deployment environment

Docker

📌 Software version

latest

💻 System environment

Other Linux

🌐 Browser

Chrome

🐛 Problem description

When using the glm-4v-plus model, the model cannot answer normally after uploading images and reports the following error:

{
  "error": {
    "code": "1210",
    "message": "The API call parameters are incorrect, please check the documentation."
  },
  "endpoint": "https://open.bigmodel.cn/api/paas/v4",
  "provider": "zhipu"
}

📷 Steps to reproduce

Select the glm-4v-plus model, upload pictures, and ask

🚦 Expected results

Read pictures normally and answer normally

📝 Supplementary information

No response

更新信息-版本名:lobehub/lobe-chat-database:latest

dosubot[bot] commented 2 weeks ago

@BiFangKNT 你好!我是Dosu,我是一个可以帮助你解决 bug、回答问题,并成为贡献者的机器人。虽然我不是人类维护者,但我会尽力帮助你。

错误代码 1210 表示 API 调用参数有误。根据现有信息,glm-4v-plus 模型的具体 API 参数要求尚未明确记录在代码库中[1]

为了进一步排查问题,建议检查以下几点:

  1. API 参数:确保上传图片时所使用的 API 参数与 glm-4v-plus 模型的要求一致。由于具体参数未明确记录,建议参考 Zhipu 提供的官方文档或 API 参考手册。

  2. 错误处理:代码库中 src/app/api/errorResponse.ts 文件处理了 API 响应的错误。错误代码 1210 可能未在特定的 switch case 中处理,因此默认返回该错误代码[2]

  3. 模型配置glm-4v-plus 模型的配置如下:

    {
      description: '视频和图像理解:具备视频内容和多图片的理解能力',
      displayName: 'GLM-4V-Plus',
      enabled: true,
      id: 'glm-4v-plus',
      tokens: 8192,
      vision: true,
    }

    该模型具备视频和图像理解能力,支持多图片处理[3]

  4. 图像预处理:确保在上传图片前进行了必要的预处理和验证检查。虽然代码库中未明确记录这些步骤,但通常包括图像格式、大小等基本验证。

如果以上检查仍无法解决问题,建议进一步调试 API 调用,或联系 Zhipu 官方支持以获取更详细的参数要求和错误处理建议。

To continue talking to Dosu, mention @dosu.

sxjeru commented 2 weeks ago

重试几次能否解决。

lobehubbot commented 2 weeks ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Can it be resolved by retrying a few times?

BiFangKNT commented 2 weeks ago

重试几次能否解决。

不知道,因为我现在在烦恼别的问题。我本地部署的logto,能够通过域名访问,能够注册登录,但是一旦新建应用就会报错,日志里看是TypeError: fetch failedgetaddrinfo ENOTFOUND lobe-auth-ui.example.com(这里域名我替换成占位符了,实际上我日志里是相应的logto控制台的域名)错误,这是怎么回事啊?

lobehubbot commented 2 weeks ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Can the problem be solved by retrying a few times?

I don't know, because I'm worried about other problems now. My locally deployed logto can be accessed through the domain name and can be registered and logged in. However, once I create a new application, an error will be reported. The logs show TypeError: fetch failed and getaddrinfo ENOTFOUND lobe-auth-ui.example.com (domain name here) I replaced it with a placeholder. In fact, the domain name of the corresponding logto console in my log is an error. What's going on?

arvinxx commented 2 weeks ago

TypeError: fetch failed和getaddrinfo ENOTFOUND lobe-auth-ui.example.com(这里域名我替换成占位符了,实际上我日志里是相应的logto控制台的域名)错误,这是怎么回事啊?

@hezhijie0327 这里也遇到域名的问题了

hezhijie0327 commented 2 weeks ago

目前找到的线索都是由于 Docker Compose Bridge 模式下将使用内建 DNS 且默认会自动添加 options ndots:0 字段引起的

https://github.com/docker/compose/issues/2847 也能解释 #3822 中添加 DNS 字段后,DNS 字段被忽略的问题

三个解决方案:

  1. 本地创建 resolv.conf 或本机 /etc/resolv.conf , 其中内容仅包含 nameserver 字段,并映射进容器中
    
    # 文件格式如下,可根据实际情况进行更改 

国内 DNS

nameserver 223.5.5.5

国外 DNS

nameserver 8.8.8.8

内网 DNS

nameserver 192.168.0.1

2. 更改 Docker 默认行为,修改 `/etc/docker/daemon.json` 配置文件后重启 Docker 进程,如:`sudo systemctl restart docker`

{ "dns-opts":[ "ndots:1" ] }


3. 从容器镜像下手,每次启动时执行 `sed -i '/ndots:0/d' /etc/resolv.conf` 来移除此字段
lobehubbot commented 2 weeks ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The clues found so far are all caused by the fact that Docker Compose Bridge mode will use the built-in DNS and automatically add the options ndots:0 field by default.

https://github.com/docker/compose/issues/2847 can also explain the problem of the DNS field being ignored after adding it in #3822

Three solutions:

  1. Create resolv.conf locally or /etc/resolv.conf locally, the content of which only contains the nameserver field and map it into the container
    
    # The file format is as follows and can be changed according to the actual situation.

Domestic DNS

nameserver 223.5.5.5

Foreign DNS

nameserver 8.8.8.8

Intranet DNS

nameserver 192.168.0.1

2. Change the default behavior of Docker, modify the `/etc/docker/daemon.json` configuration file and restart the Docker process, such as: `sudo systemctl restart docker`

{ "dns-opts":[ "ndots:1" ] }


3. Start with the container image and execute `sed -i '/ndots:0/d' /etc/resolv.conf` every time you start to remove this field.  
BiFangKNT commented 2 weeks ago

目前找到的线索都是由于 Docker Compose Bridge 模式下将使用内建 DNS 且默认会自动添加 字段引起的options ndots:0

docker/compose#2847 也能解释 #3822 中添加 DNS 字段后,DNS 字段被忽略的问题

三个解决方案:

  1. 本地创建 或本机 , 其中内容仅包含 字段,并映射进容器中resolv.conf``/etc/resolv.conf``nameserver
# 文件格式如下,可根据实际情况进行更改 

# 国内 DNS
nameserver 223.5.5.5
# 国外 DNS
nameserver 8.8.8.8
# 内网 DNS
nameserver 192.168.0.1
  1. 更改 Docker 默认行为,修改 配置文件后重启 Docker 进程,如:/etc/docker/daemon.json``sudo systemctl restart docker
{
  "dns-opts":[
    "ndots:1"
  ]
}
  1. 从容器镜像下手,每次启动时执行 来移除此字段sed -i '/ndots:0/d' /etc/resolv.conf

请问第一点具体是要怎么映射到容器里?通过volume映射吗?映射到哪个路径?我是按照官方文档里的docker-compose教程配置的。 另外请问假如用第三种方法的话,docker-compose.yml又如何配置呢?

lobehubbot commented 2 weeks ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The clues found so far are all caused by the fact that Docker Compose Bridge mode will use the built-in DNS and automatically add fields by default options ndots:0

docker/compose#2847 can also explain the problem that the DNS field is ignored after adding the DNS field in #3822

Three solutions:

  1. Create locally or locally, the content only contains the field, and is mapped into the container resolv.conf``/etc/resolv.conf``nameserver
# The file format is as follows and can be changed according to the actual situation.

# Domestic DNS
nameserver 223.5.5.5
# Foreign DNS
nameserver 8.8.8.8
# Intranet DNS
nameserver 192.168.0.1
  1. Change the default behavior of Docker, modify the configuration file and restart the Docker process, such as: /etc/docker/daemon.json``sudo systemctl restart docker
{
"dns-opts":[
"ndots:1"
]
}
  1. Start with the container image and execute it every time you start to remove this field sed -i '/ndots:0/d' /etc/resolv.conf

Please tell me how the first point is mapped to the container? Map through volume? Which path is mapped to? I configured it according to the docker-compose tutorial in the official documentation. Also, if you use the third method, how to configure docker-compose.yml?

hezhijie0327 commented 2 weeks ago

/your_path_to_lobechat/resolv.conf 创建文件,并在文件中添加以下字段(文件路径按实际情况更改)

# 此为注释,如你有自己的 DNS 服务器,可按实际情况进行更改
nameserver 223.5.5.5
nameserver 8.8.4.4

然后在 docker-compose.yml 中放入这段

    volumes:
      - '/your_path_to_lobechat/resolv.conf:/etc/resolv.conf'
lobehubbot commented 2 weeks ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Create a file in /your_path_to_lobechat/resolv.conf and add the following fields in the file (change the file path as needed)

# This is a comment. If you have your own DNS server, you can change it according to the actual situation.
nameserver 223.5.5.5
nameserver 8.8.4.4

Then put this paragraph in docker-compose.yml

volumes:
- '/your_path_to_lobechat/resolv.conf:/etc/resolv.conf'
lobehubbot commented 2 weeks ago

✅ @BiFangKNT

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

lobehubbot commented 1 week ago

:tada: This issue has been resolved in version 1.15.25 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

BiFangKNT commented 1 week ago

/your_path_to_lobechat/resolv.conf 创建文件,并在文件中添加以下字段(文件路径按实际情况更改)

# 此为注释,如你有自己的 DNS 服务器,可按实际情况进行更改
nameserver 223.5.5.5
nameserver 8.8.4.4

然后在 docker-compose.yml 中放入这段

    volumes:
      - '/your_path_to_lobechat/resolv.conf:/etc/resolv.conf'

我还有个问题,logto这里的网址写局域网地址的话,理论上不会有dns解析问题吧?但是我试过了,还是访问不了,这又是怎么回事呢?

lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Create a file in /your_path_to_lobechat/resolv.conf and add the following fields in the file (change the file path as needed)

# This is a comment. If you have your own DNS server, you can change it according to the actual situation.
nameserver 223.5.5.5
nameserver 8.8.4.4

Then put this paragraph in docker-compose.yml

volumes:
- '/your_path_to_lobechat/resolv.conf:/etc/resolv.conf'

I have another question. If the URL in logto is a LAN address, theoretically there won’t be any DNS resolution problem, right? But I tried, but still can't access it, what's going on?

BiFangKNT commented 1 week ago

/your_path_to_lobechat/resolv.conf 创建文件,并在文件中添加以下字段(文件路径按实际情况更改)

# 此为注释,如你有自己的 DNS 服务器,可按实际情况进行更改
nameserver 223.5.5.5
nameserver 8.8.4.4

然后在 docker-compose.yml 中放入这段

    volumes:
      - '/your_path_to_lobechat/resolv.conf:/etc/resolv.conf'

请问volume这段是放进logto服务中吗? 另外请问最新版本修复了这个问题,不用我再操作了吗?

lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Create a file in /your_path_to_lobechat/resolv.conf and add the following fields in the file (change the file path as needed)

# This is a comment. If you have your own DNS server, you can change it according to the actual situation.
nameserver 223.5.5.5
nameserver 8.8.4.4

Then put this paragraph in docker-compose.yml

volumes:
- '/your_path_to_lobechat/resolv.conf:/etc/resolv.conf'

Is the volume section put into the logto service?

hezhijie0327 commented 1 week ago

我看了下 logto 的镜像也是 alpine,应该是同一个问题,你试试把这个放到 logto 中

lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I looked at the image of logto and it is also alpine. It should be the same problem. You can try putting this into logto.

hezhijie0327 commented 1 week ago

或者要么把 docker-compose 网络类型改为 host 应该也就没事了...

lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Or change the docker-compose network type to host and it should be fine...

BiFangKNT commented 1 week ago

或者要么把 docker-compose 网络类型改为 host 应该也就没事了...

应该不能改吧,我有些端口冲突了,比如说lobe-postgres这个5432

lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Or change the docker-compose network type to host and it should be fine...

It shouldn’t be changed. I have some port conflicts, such as lobe-postgres 5432.

lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


resolv.conf

What does the same question mean? Is there any problem besides logto?

BiFangKNT commented 1 week ago

我看了下 logto 的镜像也是 alpine,应该是同一个问题,你试试把这个放到 logto 中

请问同一个问题是什么意思?除了logto之外还有什么问题吗?

lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I looked at the image of logto and it is also alpine. It should be the same problem. You can try putting this into logto.

What does the same question mean? Is there any problem besides logto?

BiFangKNT commented 1 week ago

我看了下 logto 的镜像也是 alpine,应该是同一个问题,你试试把这个放到 logto 中

另外我更新最新版之后,logto的DB_URL这项不能写@lobe-postgres了,请问是改成localhost吗?

lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I looked at the image of logto and it is also alpine. It should be the same problem. You can try putting this into logto.

In addition, after I updated the latest version, the DB_URL item of logto can no longer write @lobe-postgres. Should I change it to localhost?

BiFangKNT commented 1 week ago

我看了下 logto 的镜像也是 alpine,应该是同一个问题,你试试把这个放到 logto 中

之前我logto能注册但不能新建应用,现在我连注册都不行了,报的错也不一样了:Error: getaddrinfo EAI_AGAIN api.pwnedpasswords.com,但是我这是自部署的logto,为什么注册要访问这个网址?

我的resolv.conf如下:

nameserver 223.5.5.5
nameserver 119.29.29.29
nameserver 8.8.8.8
nameserver 192.168.5.1 #我的路由器地址

我的docker-compos.yml中的相关配置如下:

  postgresql:
    image: pgvector/pgvector:pg16
    container_name: lobe-postgres
    ports:
      - '5454:5432'
    volumes:
      - './data:/var/lib/postgresql/data'
    environment:
      - 'POSTGRES_DB=logto'
      - 'POSTGRES_PASSWORD=password'
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U postgres']
      interval: 5s
      timeout: 5s
      retries: 5
    restart: always

  logto:
    image: svhd/logto
    container_name: lobe-logto
    ports:
      - '13001:3001'
      - '13002:3002'
    volumes:
      - '/volume1/docker/lobechat/resolv.conf:/etc/resolv.conf:ro'
    depends_on:
      postgresql:
        condition: service_healthy
    environment:
      - 'TRUST_PROXY_HEADER=1'
      - 'DB_URL=postgresql://postgres:password@192.168.5.8:5454/logto'
      - 'ENDPOINT=https://logto.example.com'
      - 'ADMIN_ENDPOINT=https://logto-cs.example.com'
    entrypoint: ['sh', '-c', 'npm run cli db seed -- --swe && npm start']
lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I looked at the image of logto and it is also alpine. It should be the same problem. You can try putting this into logto.

Before, I could register logto but couldn't create a new application. Now I can't even register it, and the error reported is different: Error: getaddrinfo EAI_AGAIN api.pwnedpasswords.com, but this is a self-deployed logto, why do I need to register it? Visit this URL? My resolv.conf is as follows:

nameserver 223.5.5.5
nameserver 119.29.29.29
nameserver 8.8.8.8
nameserver 192.168.5.1 #My router address
BiFangKNT commented 1 week ago

我看了下 logto 的镜像也是 alpine,应该是同一个问题,你试试把这个放到 logto 中

@hezhijie0327 问了gpt,是这么说的:

这个错误表明你的 Node.js 应用在发起到 api.pwnedpasswords.com 的网络请求时遇到了 DNS 解析问题。具体分析如下:

错误信息:

  1. getaddrinfo EAI_AGAIN

    • 错误 EAI_AGAIN 是 Node.js 的 DNS 解析错误,通常表示 DNS 查询暂时性失败。此错误表明应用程序在尝试解析 api.pwnedpasswords.com 域名时无法获得 DNS 响应,可能是网络连接问题、DNS 服务器未响应或域名解析暂时不可用。
  2. 错误来源

    • 错误发生在调用 fetch 时,应用程序试图通过 GETPOST 方法向 api.pwnedpasswords.com 发送请求。
    • 错误堆栈信息指向 Node.js 内部的 dns 模块,具体地是在 GetAddrInfoReqWrap.onlookupall 期间,表明问题发生在域名解析阶段。

可能的原因:

  1. DNS 解析问题

    • 你的应用可能在发起请求时,DNS 服务器没有正确响应。可能原因包括:
      • DNS 服务器不稳定。
      • 本地或容器网络配置有问题。
      • 暂时性的网络中断。
  2. 网络问题

    • 你的服务器或容器可能无法访问外部网络,或者在请求 api.pwnedpasswords.com 时有临时的网络中断。
  3. API 不可用

    • 目标 API api.pwnedpasswords.com 可能暂时不可用,或者由于防火墙、网络策略等原因阻止了对该域名的访问。
  4. 系统负载过高

    • 系统可能负载过高,导致 DNS 查询没有在合理时间内完成。此时,DNS 解析超时发生,导致 EAI_AGAIN 错误。

解决方法:

  1. 检查网络连接

    • 确认你的服务器或容器是否能够正常访问外部网络。你可以使用 pingnslookup 测试对 api.pwnedpasswords.com 的连通性:
      ping api.pwnedpasswords.com
      nslookup api.pwnedpasswords.com
  2. DNS 配置

    • 确保你的服务器或容器配置了有效的 DNS 服务器。可以检查 /etc/resolv.conf 文件中的 DNS 设置,确保 DNS 服务器可用。
  3. 添加重试逻辑

    • 对于网络请求失败,特别是 EAI_AGAIN 这种暂时性 DNS 解析错误,添加重试机制可能会有助于提升应用的可靠性。例如,使用 fetch 时可以重试请求:
      const fetchWithRetry = async (url, options, retries = 3) => {
      for (let i = 0; i < retries; i++) {
       try {
         const response = await fetch(url, options);
         if (response.ok) return response;
       } catch (error) {
         if (i === retries - 1) throw error;
       }
      }
      };
  4. 使用稳定的 DNS 服务器

    • 如果 DNS 服务器不稳定,可以尝试使用公共 DNS,如 Google 的 8.8.8.8 或 Cloudflare 的 1.1.1.1。你可以在容器中配置这些 DNS 服务器。
  5. 增加超时时间

    • 检查和增加请求的超时时间,以防 DNS 解析或网络延迟导致的请求失败。

总结:

该问题主要是 DNS 解析失败引起的。你可以通过检查网络连接、调整 DNS 配置、以及添加请求重试逻辑来解决问题。

lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I looked at the image of logto and it is also alpine. It should be the same problem. You can try putting this into logto.

I asked gpt and this is what they said:

This error indicates that your Node.js application encountered a DNS resolution issue while making a network request to api.pwnedpasswords.com. The specific analysis is as follows:

Error message:

  1. getaddrinfo EAI_AGAIN:

    • The error EAI_AGAIN is a DNS resolution error in Node.js and usually indicates a temporary failure of the DNS query. This error indicates that the application was unable to obtain a DNS response when trying to resolve the api.pwnedpasswords.com domain name, possibly due to a network connectivity issue, a non-responsive DNS server, or a temporary unavailability of domain name resolution.
  2. Error source:

    • The error occurs when calling fetch when the application attempts to send a request to api.pwnedpasswords.com via the GET or POST method.
    • The error stack information points to the dns module inside Node.js, specifically during GetAddrInfoReqWrap.onlookupall, indicating that the problem occurs during the domain name resolution phase.

Possible reasons:

  1. DNS resolution problem:

    • The DNS server may not respond correctly when your application initiates a request. Possible reasons include:
    • DNS server is unstable.
    • There is a problem with the local or container network configuration.
    • Temporary network outage.
  2. Network Problem:

    • Your server or container may not have access to the external network, or there may be a temporary network outage when requesting api.pwnedpasswords.com.
  3. API is not available:

    • The target API api.pwnedpasswords.com may be temporarily unavailable, or access to the domain name is blocked due to firewalls, network policies, etc.
  4. System load is too high:

    • The system may be under heavy load, causing DNS queries not to complete within a reasonable time. At this point, a DNS resolution timeout occurs, causing an EAI_AGAIN error.

Solution:

  1. Check network connection:

    • Confirm whether your server or container can access the external network normally. You can test connectivity to api.pwnedpasswords.com using ping or nslookup:
      ping api.pwnedpasswords.com
      nslookup api.pwnedpasswords.com
  2. DNS Configuration:

    • Make sure your server or container is configured with a valid DNS server. You can check the DNS settings in the /etc/resolv.conf file to make sure the DNS server is available.
  3. Add retry logic:

    • For network request failures, especially temporary DNS resolution errors such as EAI_AGAIN, adding a retry mechanism may help improve the reliability of the application. For example, using fetch you can retry the request:
      const fetchWithRetry = async (url, options, retries = 3) => {
      for (let i = 0; i < retries; i++) {
      try {
      const response = await fetch(url, options);
      if (response.ok) return response;
      } catch (error) {
      if (i === retries - 1) throw error;
      }
      }
      };
  4. Use a stable DNS server:

    • If your DNS server is unstable, you can try using a public DNS such as Google's 8.8.8.8 or Cloudflare's 1.1.1.1. You can configure these DNS servers in the container.
  5. Increase timeout:

    • Check and increase request timeout in case request fails due to DNS resolution or network delays.

Summary:

This problem is mainly caused by DNS resolution failure. You can resolve the issue by checking network connectivity, adjusting DNS configuration, and adding request retry logic.

BiFangKNT commented 1 week ago

我看了下 logto 的镜像也是 alpine,应该是同一个问题,你试试把这个放到 logto 中

我把

    volumes:
      - '/volume1/docker/lobechat/resolv.conf:/etc/resolv.conf:ro'

的只读去掉,就可以注册了,但是新建应用和以前一样,还是报那个解析不了自己域名的错误:Error: getaddrinfo ENOTFOUND logto-cs.example.com(这个域名我用了占位符,实际上是正常解析到本机的,我用手机流量也能访问),也就是说之前的问题没有解决

lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I looked at the image of logto and it is also alpine. It should be the same problem. You can try putting this into logto.

I put

    volumes:
      - '/volume1/docker/lobechat/resolv.conf:/etc/resolv.conf:ro'

After removing read-only, you can register it, but the new application is the same as before, and the error that it cannot resolve its own domain name is still reported: Error: getaddrinfo ENOTFOUND logto-cs.example.com (I used a placeholder for this domain name, In fact, it is parsed to the local machine normally, and I can access it using mobile phone traffic), which means that the previous problem has not been solved.

hezhijie0327 commented 1 week ago

你这报错是在 LobeChat 还是 Logto?

lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Are you reporting this error in LobeChat or Logto?

BiFangKNT commented 1 week ago

你这报错是在 LobeChat 还是 Logto?

是logto

lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Are you reporting this error in LobeChat or Logto?

is logto

BiFangKNT commented 1 week ago

你这报错是在 LobeChat 还是 Logto?

lobechat的配置里也要加上volumes这项吗?

lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Are you reporting this error in LobeChat or Logto?

Do we also need to add volumes to the configuration of lobechat?

hezhijie0327 commented 1 week ago

你 LobeChat 对接 Logto 之间的域名是走的本地 DNS 还是公网解析?

lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Do you use local DNS or public network resolution for domain names between LobeChat and Logto?

BiFangKNT commented 1 week ago

你 LobeChat 对接 Logto 之间的域名是走的本地 DNS 还是公网解析?

走的是公网:

# 必填,指定鉴权服务提供商,这里以 Logto 为例
NEXT_AUTH_SSO_PROVIDERS=logto
# 必填,NextAuth 的 URL,用于 NextAuth 的回调
NEXTAUTH_URL=https://lobechat.example.com/api/auth

# NextAuth 鉴权服务提供商部分,以 Logto 为例
# 其他鉴权服务提供商所需的环境变量,请参考:https://lobehub.com/zh/docs/self-hosting/environment-variables/auth
LOGTO_CLIENT_ID=YOUR_LOGTO_CLIENT_ID
LOGTO_CLIENT_SECRET=YOUR_LOGTO_CLIENT_SECRET
LOGTO_ISSUER=https://logto.example.com/oidc
lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Do you use local DNS or public network resolution for domain names between LobeChat and Logto?

Using the public network:

# Required, specify the authentication service provider, take Logto as an example here
NEXT_AUTH_SSO_PROVIDERS=logto
# Required, NextAuth URL, used for NextAuth callback
NEXTAUTH_URL=https://lobechat.example.com/api/auth

# NextAuth authentication service provider part, taking Logto as an example
# For other environment variables required by authentication service providers, please refer to: https://lobehub.com/zh/docs/self-hosting/environment-variables/auth
LOGTO_CLIENT_ID=YOUR_LOGTO_CLIENT_ID
LOGTO_CLIENT_SECRET=YOUR_LOGTO_CLIENT_SECRET
LOGTO_ISSUER=https://logto.example.com/oidc
BiFangKNT commented 1 week ago

你 LobeChat 对接 Logto 之间的域名是走的本地 DNS 还是公网解析?

另外我不太理解“对接域名走本地dns还是公网解析”这句话,我域名是用腾讯云解析的,意思是说lobechat里也要加上volumes这段吗:

    volumes:
      - '/volume1/docker/lobechat/resolv.conf:/etc/resolv.conf'
lobehubbot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Do you use local DNS or public network resolution for domain names between LobeChat and Logto?

In addition, I don’t quite understand the sentence “Do you use local DNS or public network resolution to connect domain names?” My domain name is resolved using Tencent Cloud. Does this mean that the volumes section should also be added to lobechat:

    volumes:
      - '/volume1/docker/lobechat/resolv.conf:/etc/resolv.conf:'