在知识库中上传文件报错:Failed to create post presigned url
例行检查
- [x] 我已确认目前没有类似 issue
- [x] 我已完整查看过项目 README,以及项目文档
- [x] 我使用了自己的 key,并确认我的 key 是可正常使用的
- [x] 我理解并愿意跟进此 issue,协助测试和提供反馈
- [x] 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭
你的版本
- [ ] 公有云版本
- [x] 私有部署版本, 具体版本号: 4.14.3
问题描述, 日志截图,配置文件等 在知识库中上传文件报错:
[Error] 2026-01-01 13:28:57 Failed to create post presigned url
{
message: AggregateError [ECONNREFUSED]:
at internalConnectMultiple (node:net:1117:18)
at afterConnectMultiple (node:net:1684:7) {
code: 'ECONNREFUSED',
[errors]: [ [Error], [Error] ]
},
stack: 'AggregateError [ECONNREFUSED]: \n' +
' at internalConnectMultiple (node:net:1117:18)\n' +
' at afterConnectMultiple (node:net:1684:7)'
}
Load model====== system_logs
[Error] 2026-01-01 13:28:57 System unexpected error: /api/core/dataset/presignDatasetFilePostUrl, Failed to create post presigned url
{ message: 'Failed to create post presigned url', stack: undefined }
S3 init success: fastgpt-private
[Info] 2026-01-01 13:29:00 [Vector Queue] Done
[Info] 2026-01-01 13:29:00 [Parse Queue] Done
[Info] 2026-01-01 13:29:00 [QA Queue] Done 复现步骤 打开一个知识库,上传文件 预期结果 上传成功并开始处理 相关截图
docker compose配置:
plugin auth token
x-plugin-auth-token: &x-plugin-auth-token 'token'
aiproxy token
x-aiproxy-token: &x-aiproxy-token 'token'
数据库连接相关配置
x-share-db-config: &x-share-db-config MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin DB_MAX_LINK: 100 REDIS_URL: redis://default:mypassword@redis:6379 S3_EXTERNAL_BASE_URL: http://localhost:9000 # S3 的公网访问地址 S3_ENDPOINT: fastgpt-minio S3_PORT: 9000 S3_USE_SSL: false S3_ACCESS_KEY: minioadmin S3_SECRET_KEY: minioadmin S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶 S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
http://localhost:9000可以打开并且可以登录
fastgpt服务配置:fastgpt: container_name: fastgpt image: ghcr.io/labring/fastgpt:v4.14.3 # git # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.21-fix # 阿里云 ports: - 3020:3000 depends_on: - mongo - pg - sandbox restart: always environment: <<: - *x-share-db-config - *x-vec-config # 前端访问地址: http://localhost:3000 FE_DOMAIN: # root 密码,用户名为: root。如果需要修改 root 密码,直接修改这个环境变量,并重启即可。 DEFAULT_ROOT_PSW: 1234 # AI模型的API地址哦。务必加 /v1。这里默认填写了OneApi的访问地址。 OPENAI_BASE_URL: http://oneapi:3000/v1 # AI模型的API Key。(这里默认填写了OneAPI的快速默认key,测试通后,务必及时修改) CHAT_API_KEY: sk-fastgpt # 数据库最大连接数 DB_MAX_LINK: 30 # 登录凭证密钥 TOKEN_KEY: any # root的密钥,常用于升级时候的初始化请求 ROOT_KEY: root_key # 文件阅读加密 FILE_TOKEN_KEY: filetoken # 密钥加密key AES256_SECRET_KEY: fastgptkey # MongoDB 连接参数. 用户名myusername,密码mypassword。 MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin # pg 连接参数 PG_URL: postgresql://username:password@pg:5432/postgres # Redis 连接参数 REDIS_URL: redis://default:mypassword@redis:6379 # plugin 地址 PLUGIN_BASE_URL: http://fastgpt-plugin:3000 PLUGIN_TOKEN: *x-plugin-auth-token # sandbox 地址 SANDBOX_URL: http://sandbox:3000 # 日志等级: debug, info, warn, error LOG_LEVEL: info STORE_LOG_LEVEL: warn # 工作流最大运行次数 WORKFLOW_MAX_RUN_TIMES: 1000 # 批量执行节点,最大输入长度 WORKFLOW_MAX_LOOP_TIMES: 100 # 对话文件过期天数 CHAT_FILE_EXPIRE_TIME: 1000 # 自定义跨域,不配置时,默认都允许跨域(多个域名通过逗号分割) ALLOWED_ORIGINS: # 是否开启IP限制,默认不开启 USE_IP_LIMIT: false TZ: Asia/Shanghai volumes: - ./config.json:/app/data/config.json labels: - "com.centurylinklabs.watchtower.enable=true" networks: mynetwork: ipv4_address: 172.20.0.22
没有使用AI Proxy,仍然用的ONEAPI,不知道有没有关系
代码里面有bug,在配置了S3_EXTERNAL_BASE_URL的情况下,endpoint取的是url里面的hostname,也就是上传文件时用的是S3_EXTERNAL_BASE_URL的hostname。
解决方案:宿主机配一下hosts 127.0.0.1 fastgpt-minio
compose配置是这样,
代码里面有bug,在配置了S3_EXTERNAL_BASE_URL的情况下,endpoint取的是url里面的hostname,也就是上传文件时用的是S3_EXTERNAL_BASE_URL的hostname。
![]()
解决方案:宿主机配一下hosts 127.0.0.1 fastgpt-minio
compose配置是这样,
😅你这明显误导人,客户端怎么可能访问到 http://fastgpt-minio:9000 s3 是客户端上传文件。 本地直接填 http://localhost:9000 就行了,有 dns 问题就用 127.0.0.1。
代码里面有bug,在配置了S3_EXTERNAL_BASE_URL的情况下,endpoint取的是url里面的hostname,也就是上传文件时用的是S3_EXTERNAL_BASE_URL的hostname。
解决方案:宿主机配一下hosts 127.0.0.1 fastgpt-minio compose配置是这样,
😅你这明显误导人,客户端怎么可能访问到 http://fastgpt-minio:9000 s3 是客户端上传文件。 本地直接填 http://localhost:9000 就行了,有 dns 问题就用 127.0.0.1。
localhost和127.0.0.1都试过了,上传文件时还是报上面同样的错误[捂脸],fastgpt镜像版本4.14.4
代码里面有bug,在配置了S3_EXTERNAL_BASE_URL的情况下,endpoint取的是url里面的hostname,也就是上传文件时用的是S3_EXTERNAL_BASE_URL的hostname。
解决方案:宿主机配一下hosts 127.0.0.1 fastgpt-minio compose配置是这样,
😅你这明显误导人,客户端怎么可能访问到 http://fastgpt-minio:9000 s3 是客户端上传文件。 本地直接填 http://localhost:9000 就行了,有 dns 问题就用 127.0.0.1。
localhost和127.0.0.1都试过了,上传文件时还是报上面同样的错误[捂脸],fastgpt镜像版本4.14.4
这么奇怪🧐。 你这两个地址能打开 minio 管理台么? 看看客户端拿到的上传文件签名链接是怎么样的。 这个错误是指上传地址跟签名链接不符。
代码里面有bug,在配置了S3_EXTERNAL_BASE_URL的情况下,endpoint取的是url里面的hostname,也就是上传文件时用的是S3_EXTERNAL_BASE_URL的hostname。
解决方案:宿主机配一下hosts 127.0.0.1 fastgpt-minio compose配置是这样,
😅你这明显误导人,客户端怎么可能访问到 http://fastgpt-minio:9000 s3 是客户端上传文件。 本地直接填 http://localhost:9000 就行了,有 dns 问题就用 127.0.0.1。
localhost和127.0.0.1都试过了,上传文件时还是报上面同样的错误[捂脸],fastgpt镜像版本4.14.4
你再试试用 ipv4 地址呢(要检查下能访问 minio)
@ynull @sanpatricky 填宿主机的 IP
ifconfig
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
ether xx:xx:xx:xx:xx:xx
inet6 fe80::xxxx:xxxx:xxxx:xxxx%en0 prefixlen 64 scopeid 0xe
inet6 fdxx::xxxx:xxxx:xxxx:xxxx prefixlen 64 autoconf
inet 192.168.x.x netmask 0xffff8000 broadcast 192.168.x.x
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
测试了,好像跟这个配置无关。 *# 数据库连接相关配置 x-share-db-config: &x-share-db-config MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin DB_MAX_LINK: 100 REDIS_URL: redis://default:mypassword@redis:6379 S3_EXTERNAL_BASE_URL: http://fastgpt-minio.lan:9000 # S3 的公网访问地址 S3_ENDPOINT: fastgpt-minio S3_PORT: 9000 S3_USE_SSL: false S3_ACCESS_KEY: minioadmin S3_SECRET_KEY: minioadmin S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶 S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶 我在内网解析fastgpt-minio.lan到服务器(192.168.1.8),使用内网其他电脑浏览器打开http://fastgpt-minio.lan:9000,会自动跳转http://fastgpt-minio.lan:9001能访问并登录minio 。【其实用填写http://192.168.1.8:9000,也一样】,最后:知识库和对话都一样,上传失败,报同样错误。
测试了,好像跟这个配置无关。 *# 数据库连接相关配置 x-share-db-config: &x-share-db-config MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin DB_MAX_LINK: 100 REDIS_URL: redis://default:mypassword@redis:6379 S3_EXTERNAL_BASE_URL: http://fastgpt-minio.lan:9000 # S3 的公网访问地址 S3_ENDPOINT: fastgpt-minio S3_PORT: 9000 S3_USE_SSL: false S3_ACCESS_KEY: minioadmin S3_SECRET_KEY: minioadmin S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶 S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶 我在内网解析fastgpt-minio.lan到服务器(192.168.1.8),使用内网其他电脑浏览器打开http://fastgpt-minio.lan:9000,会自动跳转http://fastgpt-minio.lan:9001能访问并登录minio 。【其实用填写http://192.168.1.8:9000,也一样】,最后:知识库和对话都一样,上传失败,报同样错误。
那你可能得自己测试下这个内网解析的地址是否完全支持 minio 的请求,是不是存在未转发的 header 参数了。参考 nginx 配置:
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log warn;
# 性能优化
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
client_max_body_size 1g;
# 添加 gzip 压缩
gzip on;
gzip_vary on;
gzip_min_length 1000;
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/x-component;
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=file_cache:10m max_size=1g inactive=7d use_temp_path=off;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
# 健康检查端点
location = /health {
access_log off;
return 200 "healthy\n";
add_header content-type text/plain;
}
# 修复: 如果后端需要 https,使用 https://;如果不需要,移除 ssl 相关设置
location / {
# 选项1: 如果后端是 http(推荐)
proxy_pass http://xxx;
proxy_set_header host $http_host;
# 关键修改2:超时时间改为 5 分钟(300 秒,原 60s)
proxy_connect_timeout 300s; # 建立连接超时(5分钟)
proxy_send_timeout 300s; # 发送数据超时(5分钟,适配大文件上传)
proxy_read_timeout 300s; # 等待后端响应超时(5分钟)
proxy_http_version 1.1;
proxy_set_header upgrade $http_upgrade;
proxy_set_header connection "upgrade";
proxy_cache_bypass $http_upgrade;
proxy_set_header x-real-ip $remote_addr;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header x-forwarded-proto $scheme;
# 改进的安全头
proxy_hide_header x-frame-options;
add_header x-xss-protection "1; mode=block";
add_header x-content-type-options nosniff;
# 更严格的 csp,移除 unsafe-eval 和通配符
add_header content-security-policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'self'; font-src 'self'; frame-ancestors 'self'; form-action 'self'";
# 添加错误页面处理
error_page 404 500 502 503 504 /50x.html;
}
# 错误页面
location = /50x.html {
root /usr/share/nginx/html;
internal;
}
# 限制访问敏感路径
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
server_tokens off;
}
}
测试了,好像跟这个配置无关。 *# 数据库连接相关配置 x-share-db-config: &x-share-db-config MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin DB_MAX_LINK: 100 REDIS_URL: redis://default:mypassword@redis:6379 S3_EXTERNAL_BASE_URL: http://fastgpt-minio.lan:9000 # S3 的公网访问地址 S3_ENDPOINT: fastgpt-minio S3_PORT: 9000 S3_USE_SSL: false S3_ACCESS_KEY: minioadmin S3_SECRET_KEY: minioadmin S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶 S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶 我在内网解析fastgpt-minio.lan到服务器(192.168.1.8),使用内网其他电脑浏览器打开http://fastgpt-minio.lan:9000,会自动跳转http://fastgpt-minio.lan:9001能访问并登录minio 。【其实用填写http://192.168.1.8:9000,也一样】,最后:知识库和对话都一样,上传失败,报同样错误。
那你可能得自己测试下这个内网解析的地址是否完全支持 minio 的请求,是不是存在未转发的 header 参数了。参考 nginx 配置:
events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; error_log /var/log/nginx/error.log warn; # 性能优化 sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; client_max_body_size 1g; # 添加 gzip 压缩 gzip on; gzip_vary on; gzip_min_length 1000; gzip_types application/atom+xml application/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component; proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=file_cache:10m max_size=1g inactive=7d use_temp_path=off; server { listen 80 default_server; listen [::]:80 default_server; server_name _; # 健康检查端点 location = /health { access_log off; return 200 "healthy\n"; add_header content-type text/plain; } # 修复: 如果后端需要 https,使用 https://;如果不需要,移除 ssl 相关设置 location / { # 选项1: 如果后端是 http(推荐) proxy_pass http://xxx; proxy_set_header host $http_host; # 关键修改2:超时时间改为 5 分钟(300 秒,原 60s) proxy_connect_timeout 300s; # 建立连接超时(5分钟) proxy_send_timeout 300s; # 发送数据超时(5分钟,适配大文件上传) proxy_read_timeout 300s; # 等待后端响应超时(5分钟) proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection "upgrade"; proxy_cache_bypass $http_upgrade; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header x-forwarded-proto $scheme; # 改进的安全头 proxy_hide_header x-frame-options; add_header x-xss-protection "1; mode=block"; add_header x-content-type-options nosniff; # 更严格的 csp,移除 unsafe-eval 和通配符 add_header content-security-policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'self'; font-src 'self'; frame-ancestors 'self'; form-action 'self'"; # 添加错误页面处理 error_page 404 500 502 503 504 /50x.html; } # 错误页面 location = /50x.html { root /usr/share/nginx/html; internal; } # 限制访问敏感路径 location ~ /\. { deny all; access_log off; log_not_found off; } server_tokens off; } }
问题核心在于 FastGPT 后端程序无法与 Minio 成功通信 以生成预签名链接。 时钟同步 确保服务器时间和你的电脑时间一致(误差 > 15分钟会导致签名失效) 容器和系统时间同步,不再提示[Failed to create post presigned url]. 但是 配置使用 http://fastgpt-minio:9000,会提示网络错误,外面上传(浏览器中)访问不了这个。
代码里面有bug,在配置了S3_EXTERNAL_BASE_URL的情况下,endpoint取的是url里面的hostname,也就是上传文件时用的是S3_EXTERNAL_BASE_URL的hostname。
解决方案:宿主机配一下hosts 127.0.0.1 fastgpt-minio compose配置是这样,
😅你这明显误导人,客户端怎么可能访问到 http://fastgpt-minio:9000 s3 是客户端上传文件。 本地直接填 http://localhost:9000 就行了,有 dns 问题就用 127.0.0.1。
localhost和127.0.0.1都试过了,上传文件时还是报上面同样的错误[捂脸],fastgpt镜像版本4.14.4
这么奇怪🧐。 你这两个地址能打开 minio 管理台么? 看看客户端拿到的上传文件签名链接是怎么样的。 这个错误是指上传地址跟签名链接不符。
可以打开minio管理后台,因为我是本地部署和访问,这样配是可以的;配成其他的比如localhost也是一样的错误,宿主机ip会变,所以这样配+hosts对我目前最合适😂
抓包提示说CORS安全策略问题,找AI解决方案是可以在浏览器端临时禁用CORS安全策略(仅用于调试)。请注意,这仅用于开发环境临时测试,绝对不要在生产环境中使用。 Chrome:可以添加 --disable-web-security 启动参数。
配置成
抓包提示说CORS安全策略问题,找AI解决方案是可以在浏览器端临时禁用CORS安全策略(仅用于调试)。请注意,这仅用于开发环境临时测试,绝对不要在生产环境中使用。 Chrome:可以添加 --disable-web-security 启动参数。
验证过了么
macbook,docker desktop,试过了以下几个方法:
- 改host,配置127.0.0.1 fastgpt-minio.local,刷新DNS 改docker compose里:
- 127.0.0.1:9000
- localhost:9000
- host.docker.internal:9000 都还是报错。
配置localhost跟开始的错误一样,配置成127.0.0.1,错误变成了: [Error] 2026-01-10 21:35:20 Failed to create post presigned url
{
message: 'connect ECONNREFUSED 127.0.0.1:9000',
stack: 'Error: connect ECONNREFUSED 127.0.0.1:9000\n' +
' at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1606:16)'
}
Load model====== system_logs
{ message: 'Failed to create post presigned url', stack: undefined }
[Error] 2026-01-10 21:35:20 System unexpected error: /api/core/dataset/presignDatasetFilePostUrl, Failed to create post presigned url
改成host.docker.internal:9000,页面直接报网络异常,日志无记录
大佬,还有什么解决方案?
docker compose配置文件里给fastgpt服务已经加了配置: extra_hosts: host.docker.internal: host-gateway
还是回归到http://fastgpt-minio:9000的配置吧,不折腾了:
进入fastgpt容器内部: ping fastgpt-minio PING fastgpt-minio (172.20.0.35): 56 data bytes 64 bytes from 172.20.0.35: seq=0 ttl=42 time=0.036 ms 64 bytes from 172.20.0.35: seq=1 ttl=42 time=0.048 ms 64 bytes from 172.20.0.35: seq=2 ttl=42 time=0.037 ms
上传文件,页面报错:
还是回归到http://fastgpt-minio:9000的配置吧,不折腾了:
进入fastgpt容器内部: ping fastgpt-minio PING fastgpt-minio (172.20.0.35): 56 data bytes 64 bytes from 172.20.0.35: seq=0 ttl=42 time=0.036 ms 64 bytes from 172.20.0.35: seq=1 ttl=42 time=0.048 ms 64 bytes from 172.20.0.35: seq=2 ttl=42 time=0.037 ms
上传文件,页面报错:
![]()
看上面评论,别搞这么花里胡哨,直接用个 ipv4 地址就好了。 容器里请求 Ipv4:9000 能通就行。
192.168.10.110 是我本机网络的 ip,可以访问到 minio。externalurl 里填 http://192.168.10.110:9000 就成功了。 当然,上面提到的时间也是个问题,不过绝大多数部署时候,时间都是一致的。
我本机的ip地址是53开头的办公网络,没有192.168类似的ip,在本机用http://ip:9000大不开minio,在容器内部也ping不通本机ip。这样就用不了么?
看了最新版本的docker compose配置文件,说明要配置一个服务器和客户端均可访问到存储桶的地址。为啥客户端也要能访问到呢?前端代码直接访问了桶么?
升级到了最新版本,配置了localhost,删除了plugin,minio和fastgpt三个镜像,然后带着--no-recreate启动docker compose,解决了 虽然在线的docker compose文件里说了不让用localhost,其实还是可以用的
解决方案:宿主机配一下hosts
127.0.0.1 fastgpt-minio
compose配置是这样,
