settings/map returns 500: googleMapsApiKey() returns null for its string return type (no Google Maps key configured)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
GET /int/v1/fleet-ops/settings/map の Fleetbase\FleetOps\Http\Controllers\Internal\v1\SettingController::googleMapsApiKey() と、そのエントリーポイントである getMapSettings() から始めます。Google Maps キーを設定しない状態で再現し、その後、エンドポイントが TypeError を発生させずに 200 を返し、空のキーの場合の動作を維持することを確認します。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- PHP
- スター
- 40
- フォーク
- 72
- 平均マージ
- 19時間
- マージ済み PR(30日)
- 66
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
fleetbase/fleetops のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
fleetbase/fleetops#334 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
ST_MakeEnvelope breaks MariaDB and fails on MySQL with SRID 4326 spatial columns再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
fleetbase/fleetops の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
pluginsGLPI/addressing#127 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
TYPO3BestPractices/tea#2409 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
api-platform/core#8690 ·
メンテナーはふだん 1 日以内に返信
-
No Code Attached Yet
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
joomla/joomla-cms#48626 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
DorsetDigital/silverstripe-schema-manager#26 ·
メンテナーはふだん 1 日以内に返信