Repository navigation
fix: resolve geocoder endpoints through the configured fleetops geocoder - #408
Merged
roncodes merged 2 commits intoOct 19, 2026
Merged
Conversation
The internal geocoder/query and geocoder/reverse endpoints used the geocoder-laravel facade, whose Google provider is built from config/geocoder.php when the config loads, before the API key from the settings table is set. Its Chain provider swallowed the resulting failure, so both endpoints returned [] while places/lookup, which goes through Geocoding, resolved the same address. Route both lookups through Geocoding::geocoder() so they share the settings-backed API key, region and locale. Fixes fleetbase/fleetbase#723
This was referenced Oct 19, 2026
Merged
GeocoderController no longer resolves the geocoder-laravel facade, so
the seam test's app('geocoder') stand-in was never consulted and the
unbound fleetops geocoder tried a live Google request.
roncodes
added a commit
that referenced
this pull request
Oct 19, 2026
Place, PlaceSearch and the v1 Place and Driver controllers still called the geocoder-laravel facade. Its Google provider is built from config/geocoder.php when the config loads, before the settings-table API key is set, and its Chain provider swallows the failure, so these lookups silently returned no results (the same bug #408 fixed for the internal geocoder endpoints). They now go through Geocoding::geocoder(). Geocoding::lookupAddress() and lookupCoordinates() return the raw address results; a failed lookup still resolves to an empty collection, so place creation keeps its raw-address fallback, but the failure is now logged instead of hidden. The driver tracking endpoint keeps calling the geocoder directly so its failures still reach Sentry. config/geocoder.php now passes the region where GoogleMaps expects it (it passed the locale) and uses the default cache store instead of a 'geocode' store that does not exist. It only matters for code outside fleetops that still uses the facade. Tests bind 'fleetops.geocoder' stand-ins instead of app('geocoder'). Refs fleetbase/fleetbase#723
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v0.6.74 #408 +/- ##
===================================================
Coverage 100.00% 100.00%
- Complexity 13591 13592 +1
===================================================
Files 634 634
Lines 49331 49333 +2
===================================================
+ Hits 49331 49333 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes fleetbase/fleetbase#723
Problem
GET /int/v1/geocoder/queryand/int/v1/geocoder/reversereturn[]for addresses thatplaces/lookupresolves without trouble.GeocoderControllerused thegeocoder-laravelfacade. Its Google provider is built fromconfig/geocoder.php, and that file is evaluated when config loads, before the Google Maps API key from the settings table is set. So installs that set the key in the console end up with a provider that has no key. The facade'sChainprovider catches the resulting failure and returns an empty collection, and the controller returns that as[]. The config also passes the locale where the provider expects the region.This breaks address lookups in ember-ui's
CoordinatesInput,ModelCoordinatesInputandAutocompleteInput, for example on the place edit screen.Fix
Geocoding::geocoder(), a public accessor for the geocoder thatplaces/lookupandPlaceSearchalready use. It reads the API key from settings and has the correct region and locale.GeocoderController::forwardGeocode()andreverseGeocode()now runGeocodeQuery/ReverseQuerythrough that geocoder. The response shape is unchanged.Provider errors, such as an invalid key, now propagate instead of turning into a silent
[]. The ember-ui consumers already catch fetch errors.Tests
fleetops.geocoder, and fails if anything touches the facade. Without the controller change it fails withgeocoder facade should not be used.LookupAndGeocoderControllerContractsTest,GeocodingInjectedClientTest,FleetOpsSupportContractsTestandPlaceSearchRankingTestall pass. php-cs-fixer is clean. phpstan output on the touched files is the same as before.Not tested against a live Google Maps key.
Out of scope
Place::createFromGeocodingLookup/createFromReverseGeocodingLookup,PlaceSearch, and the public APIPlaceController/DriverControllerstill use the facade, so they have the same settings-key problem. They can move over in a follow-up.