Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

settings/map returns 500: googleMapsApiKey() returns null for its string return type (no Google Maps key configured)

オープン 初心者向け
#337 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
90/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php
領域
api, backend

調査の方向性

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

  1. Self-hosted install with no GOOGLE_MAPS_API_KEY and no Google Maps key saved in Admin → Settings → Services.
  2. Log in and open Fleet-Ops (or switch organization and open Fleet-Ops).
  3. 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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fleetbase/fleetops のほかの issue

fleetbase/fleetops の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。