WeKnora icon indicating copy to clipboard operation
WeKnora copied to clipboard

[Bug]: 使用 COS 时后端服务启动失败

Open yyykf opened this issue 1 year ago • 0 comments

相关组件

后端服务及API

Bug 描述

在 .env 中配置使用 COS,并配置相关的环境变量。

STORAGE_TYPE=cos
# 如果使用腾讯云COS作为文件存储,需要配置以下参数

# 腾讯云COS的访问密钥ID
COS_SECRET_ID=AKIDGM*******

# 腾讯云COS的密钥
COS_SECRET_KEY=1oNlvs*******

# 腾讯云COS的区域,例如 ap-guangzhou
COS_REGION=ap-guangzhou

# 腾讯云COS的桶名称
COS_BUCKET_NAME=rag*******

# 腾讯云COS的应用ID
COS_APP_ID=*******

# 腾讯云COS的路径前缀,用于存储文件
COS_PATH_PREFIX=weknora

# COS_ENABLE_OLD_DOMAIN=true 表示启用旧的域名格式,默认为 true
COS_ENABLE_OLD_DOMAIN=true

使用 ./scripts/start_all.sh 启动后,后端服务无法启动,日志缺少 COS 环境变量。

期望行为

后端服务正常启动

相关日志

- app 容器启动日志


2025-09-08 23:11:19,583 INFO Set uid to user 0 succeeded
2025-09-08 23:11:19,586 INFO RPC interface 'supervisor' initialized
2025-09-08 23:11:19,586 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2025-09-08 23:11:19,586 INFO supervisord started with pid 1
2025-09-08 23:11:20,591 INFO spawned: 'WeKnora' with pid 7
2025-09-08 23:11:22,453 INFO success: WeKnora entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-09-08 23:11:22,453 INFO exited: WeKnora (exit status 1; not expected)
2025-09-08 23:11:23,460 INFO spawned: 'WeKnora' with pid 14
2025-09-08 23:11:25,271 INFO success: WeKnora entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-09-08 23:11:25,271 INFO exited: WeKnora (exit status 1; not expected)
2025-09-08 23:11:26,279 INFO spawned: 'WeKnora' with pid 21
2025-09-08 23:11:28,067 INFO success: WeKnora entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-09-08 23:11:28,068 INFO exited: WeKnora (exit status 1; not expected)
2025-09-08 23:11:29,072 INFO spawned: 'WeKnora' with pid 28
2025-09-08 23:11:30,790 INFO success: WeKnora entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025-09-08 23:11:30,790 INFO exited: WeKnora (exit status 1; not expected)
2025-09-08 23:11:31,796 INFO spawned: 'WeKnora' with pid 35


- WeKnora.log 日志


INFO [2025-09-08 23:15:37.813] []                      | Ollama base URL: http://host.docker.internal:11434
[DocReader] 2025/09/08 23:15:38.175031 INFO: Creating new DocReader client connecting to docreader:50051
[DocReader] 2025/09/08 23:15:38.175265 INFO: Successfully connected to DocReader service in 109.259µs
2025/09/08 23:15:38.175347 main.go:102: Failed to run application: could not build arguments for function "main".main.func1 (/app/cmd/server/main.go:40): failed to build *gin.Engine: could not build arguments for function "github.com/Tencent/WeKnora/internal/router".NewRouter (/app/internal/router/router.go:35): failed to build *handler.KnowledgeBaseHandler: could not build arguments for function "github.com/Tencent/WeKnora/internal/handler".NewKnowledgeBaseHandler (/app/internal/handler/knowledgebase.go:21): failed to build interfaces.KnowledgeService: could not build arguments for function "github.com/Tencent/WeKnora/internal/application/service".NewKnowledgeService (/app/internal/application/service/knowledge.go:66): failed to build interfaces.FileService: received non-nil error from function "github.com/Tencent/WeKnora/internal/container".initFileService (/app/internal/container/container.go:202): missing COS configuration
^C

操作系统

macOS 15.6

确认事项

  • [x] 我已经搜索了现有的 issues,确认这是一个新问题

yyykf avatar Sep 08 '25 15:09 yyykf