settings/map returns 500: googleMapsApiKey() returns null for its string return type (no Google Maps key configured)
Maintainer thường phản hồi trong vòng 1 ngày
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
- 90/100
Hướng nghiên cứu
Bắt đầu tại Fleetbase\FleetOps\Http\Controllers\Internal\v1\SettingController::googleMapsApiKey() và entry point getMapSettings() của nó cho GET /int/v1/fleet-ops/settings/map. Tái hiện khi chưa cấu hình khóa Google Maps, sau đó xác minh endpoint trả về 200 mà không phát sinh TypeError và vẫn giữ nguyên hành vi với khóa rỗng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Fleetbase\FleetOps\Http\Controllers\Internal\v1\SettingController::googleMapsApiKey() is declared with a string return type, but returns null when no Google Maps API key is configured:
protected function googleMapsApiKey(): string
{
return config('services.google_maps.api_key', env('GOOGLE_MAPS_API_KEY', ''));
}
services.google_maps.api_key exists in the config (populated from env('GOOGLE_MAPS_API_KEY')), so when the variable is not set its value is null and the '' default is never used. PHP throws:
TypeError: Fleetbase\FleetOps\Http\Controllers\Internal\v1\SettingController::googleMapsApiKey(): Return value must be of type string, null returned
Impact
GET /int/v1/fleet-ops/settings/map (getMapSettings()) returns 500 for every organization. The console requests it when entering Fleet-Ops, so the Orders route fails ("Error while processing route: console.fleet-ops.operations.orders.index.index Server Error") and the UI stays on "Loading orders". Fleet-Ops is unusable on any install that uses Leaflet and has no Google Maps key, which is the default setup.
Versions
Fleetbase v0.7.63 (fleetops v0.6.68).
Reproduction
- Self-hosted install with no
GOOGLE_MAPS_API_KEYand no Google Maps key saved in Admin → Settings → Services. - Log in and open Fleet-Ops (or switch organization and open Fleet-Ops).
GET /int/v1/fleet-ops/settings/map→ 500; the orders view never loads.
config('services.google_maps.api_key'); // null
app(SettingController::class)->getMapSettings(); // TypeError
Suggested fix
protected function googleMapsApiKey(): string
{
return (string) (config('services.google_maps.api_key') ?? env('GOOGLE_MAPS_API_KEY', ''));
}
Workaround
Set GOOGLE_MAPS_API_KEY="(empty)" on the API container: Laravel reads it as an empty string and the endpoint returns 200.
- Ngôn ngữ chính
- PHP
- Star
- 36
- Fork
- 69
- Merge trung bình
- 1 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 32
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
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 fleetbase/fleetops
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[GFI] Custom Tracking NumbersĐang mởenhancement good first issue help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của fleetbase/fleetops
Issue tương tự
-
UX
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ProfessionalWiki/NeoWiki#1573 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày