Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法上传文件和图片 #5515

Open
CitizenScyu opened this issue Jan 20, 2025 · 6 comments
Open

无法上传文件和图片 #5515

CitizenScyu opened this issue Jan 20, 2025 · 6 comments
Labels
🐛 Bug Something isn't working | 缺陷 files 上传文件/知识库

Comments

@CitizenScyu
Copy link

CitizenScyu commented Jan 20, 2025

📦 部署环境

Docker

📌 软件版本

v1.47.4 数据库版本

💻 系统环境

Windows

🌐 浏览器

Edge

🐛 问题描述

上传文件时报错
文件上传失败
请确认你的网络是否正常,并检查文件存储服务跨域配置是否正确

# 基础 URL 配置
APP_URL=https://域名
# S3 配置
S3_BUCKET=lobechat
S3_ENDPOINT=https://域名1.r2.cloudflarestorage.com
S3_PUBLIC_DOMAIN=https://r2.域名2.us.kg
S3_ACCESS_KEY_ID=fef0483e3c17c302b3e95c6266351eXX
S3_SECRET_ACCESS_KEY=9f566cb82522772212cc22d9d23151941a701a96a24d00d9d673e0d50d2f29XX

存储桶配置
公共 URL 访问
不允许
默认存储类
类:标准
自定义域:r2.域名2.us.kg
R2.dev 子域  不允许
CORS 策略
[
  {
    "AllowedOrigins": [
      "https://域名"
    ],
    "AllowedMethods": [
      "GET",
      "PUT",
      "HEAD",
      "POST",
      "DELETE"
    ],
    "AllowedHeaders": [
      "*"
    ]
  }
]

📷 复现步骤

我仔细对照了教程https://lobehub.com/zh/docs/self-hosting/advanced/s3/cloudflare-r2 是在没发现问题在哪里 烦请帮忙看看

🚦 期望结果

No response

📝 补充信息

No response

@CitizenScyu CitizenScyu added the 🐛 Bug Something isn't working | 缺陷 label Jan 20, 2025
@github-project-automation github-project-automation bot moved this to Roadmap - Chat 1.x in Lobe Chat Routine Jan 20, 2025
@lobehubbot
Copy link
Member

👀 @CitizenScyu

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
Copy link
Member

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


📦 Deployment environment

Docker

📌 Software version

v1.47.4 database version

💻 System environment

Windows

🌐 Browser

Edge

🐛 Problem description

Error when uploading file
File upload failed
Please confirm whether your network is normal and check whether the cross-domain configuration of the file storage service is correct.

#Basic URL configuration
APP_URL=https://domain name

S3 configuration

S3_BUCKET=lobechat
S3_ENDPOINT=https://domainname.r2.cloudflarestorage.com/lobe
S3_PUBLIC_DOMAIN=https://r2.domain name2.us.kg
S3_ACCESS_KEY_ID=fef0483e3c17c302b3e95c6266351e41
S3_SECRET_ACCESS_KEY=9f566cb82522772212cc22d9d23151941a701a96a24d00d9d673e0d50d2f2974

Bucket configuration
Public URL access
not allowed
Default storage class
Class: Standard
Custom domain: r2.domain name2.us.kg
R2.dev subdomain not allowed
CORS policy
[
{
"AllowedOrigins": [
"https://domain name"
],
"AllowedMethods": [
"GET",
"PUT",
"HEAD",
"POST",
"DELETE"
],
"AllowedHeaders": [
"*"
]
}
]

📷 Steps to reproduce

I carefully checked the tutorial https://lobehub.com/zh/docs/self-hosting/advanced/s3/cloudflare-r2 and couldn’t find the problem. Please help.

🚦 Expected results

No response

📝 Supplementary information

No response

@dosubot dosubot bot added the files 上传文件/知识库 label Jan 20, 2025
Copy link

dosubot bot commented Jan 20, 2025

@CitizenScyu 你好! 我是Dosu,一个可以帮助解决错误、回答问题并成为贡献者的机器人。我在这里帮助你等待人类维护者。

I found some similar discussions that might be relevant to your issue:

  1. [Bug] 上传文件报错,已经对接cloudflareR2存储 - This discussion is still open and might contain insights related to your problem [1].
  2. [Bug] 文件上传失败,Cross跨域问题, 腾讯云存储桶已配置跨域 - This is another open discussion that deals with CORS issues, which might be similar to what you're experiencing [2].
  3. [Bug] 知识库上传文件报错 - This discussion is also open and might provide additional context or solutions [3].

Regarding your specific issue, here are a few things to check based on the information provided:

  1. S3 Endpoint Configuration: Ensure that your S3_ENDPOINT does not include the bucket name in the path. It should be formatted as S3_ENDPOINT=https://your-domain.r2.cloudflarestorage.com without /lobe at the end [4].

  2. CORS Configuration: Your CORS settings seem correct, but double-check that the AllowedOrigins matches exactly with the domain from which you are making requests. Any mismatch can cause CORS errors [4].

  3. Network and Access Keys: Verify that your network connection is stable and that the S3 access keys are correctly set in your environment variables. Incorrect keys can lead to authentication failures [4].

  4. Public Access: Ensure that public access is configured according to your needs. If public access is not required, it should be disabled, but make sure this aligns with your application's requirements [4].

These steps should help you troubleshoot the file upload issue in your lobe-chat application. If the problem persists, reviewing the similar discussions might provide additional insights or solutions.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@lobehubbot
Copy link
Member

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


I also have the same problem, the configuration is as follows:
APP_URL:https://example.com/
minio:
S3_ENDPOINT=https://s3.example.com
S3_PUBLIC_DOMAIN=https://s3.example.com
Appeared when requesting:
https://detochat.s3.detochat.com/files/482616/0a63751f-476f-4c75-8db4-59760cc99d50.docx?X-Amz-Algorith m=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=gcb1wHsVvwRpJaXmqjOz%2F202501

@casyalex
Copy link

same issue. endpoint 或 public domain 无生效

@lobehubbot
Copy link
Member

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


Same issue. endpoint or public domain has no effect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷 files 上传文件/知识库
Projects
Status: Roadmap - Chat 1.x
Development

No branches or pull requests

3 participants