[Bug] Hardcoded backend API URL in vite.config.ts breaks dev proxy on default port 8080 and custom environment
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript, vite
Hướng nghiên cứu
Bắt đầu với các dòng 40–44 trong config-ui/vite.config.ts và so sánh proxy /api với proxy /grafana có thể cấu hình bên dưới nó. Kiểm tra cổng backend mặc định trong .env.example, docker-compose-dev.yml và AGENTS.md, sau đó chạy config-ui bằng yarn dev với cả môi trường mặc định và môi trường được ghi đè. Hoàn thành khi các yêu cầu /api đến được backend đã cấu hình mà không chỉnh sửa cấu hình Vite được theo dõi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Search before asking
- I had searched in the issues and found no similar issues.
What happened
n config-ui/vite.config.ts, the /api dev proxy target is hardcoded directly to http://localhost:8081/:
// config-ui/vite.config.ts
proxy: {
'/api': {
target: 'http://localhost:8081/',
changeOrigin: true,
rewrite: (path) => path.replace(/^/api//, ''),
},
// ...
}
This causes two problems:
Port mismatch with the default backend
The DevLake backend defaults to port 8080, as defined in .env.example, docker-compose-dev.yml, and AGENTS.md.
Anyone starting the backend on its default port and launching config-ui gets ECONNREFUSED proxy errors unless they modify vite.config.ts or change their backend port.
Inflexible development/container setup
When developing inside Dev Containers, Docker, or with a remote backend host, the API target cannot be overridden via environment variables without modifying the tracked vite.config.ts file.
In contrast, the /grafana proxy directly below it in the same file already supports dynamic configuration via:
VITE_GRAFANA_URL
VITE_GRAFANA_PORT
VITE_GRAFANA_HOST
VITE_GRAFANA_PROTOCOL
These variables were introduced in PR #8645.
What do you expect to happen
The /api proxy should:
Default to the DevLake backend's default port (8080).
Allow the backend host, protocol, and port to be overridden through environment variables.
Avoid requiring developers to modify the tracked vite.config.ts file for different development or container environments.
How to reproduce
- Start DevLake backend on the default port (http://localhost:8080).
- Run config-ui with yarn dev (runs on http://localhost:4000).
- Open http://localhost:4000/ in the browser.
- Any API request directed to /api/... fails with ECONNREFUSED because Vite
forwards requests to http://localhost:8081/.
Anything else
• File: config-ui/vite.config.ts (lines 40–44)
• Consistent with how config-ui/nginx.conf and config-ui/nginx.sh
dynamically use ${DEVLAKE_ENDPOINT} in production.
I found this while developing grafana_irm plugin
Version
main (commit 05dad99c8)
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
- Ngôn ngữ chính
- Go
- Star
- 3.1k
- Fork
- 812
- Merge trung bình
- 1 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 48
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/devlake
-
Stale type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
type/bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
apache/devlake#9142 · 2 bình luận · 1 reaction · 1 người được giao ·
Tất cả issue của apache/devlake
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
-
enhancement needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
kind/cleanup
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
kubernetes-sigs/kueue#15947 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
sympozium-ai/sympozium#627 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100