"As of March 1st, 2025, google.maps.places.Autocomplete is not available to new customers"
Description
I noticed this in my console today trying to use the places library from the useMapsLibrary hook:
Steps to Reproduce
const places = useMapsLibrary('places');
useEffect(() => {
if (!places || !inputRef.current) return;
const options = {
fields: ['geometry', 'name', 'formatted_address']
};
const autocomplete = new places.Autocomplete(inputRef.current, options);
setPlaceAutocomplete(autocomplete);
// If we have an initial search, trigger a search
if (initialSearch && inputRef.current) {
inputRef.current.value = initialSearch;
// Use the Geocoding service to find the place
const geocoder = new google.maps.Geocoder();
geocoder.geocode({ address: initialSearch }, (results, status) => {
if (status === 'OK' && results?.[0]) {
onPlaceSelect(
results[0] as unknown as google.maps.places.PlaceResult
);
}
});
}
}, [places, initialSearch, onPlaceSelect]);
Environment
- Library version:
"@vis.gl/react-google-maps": "^1.5.1", - Google maps version: ???
- Browser and Version: Chrome
- OS: MacOS Sequoia 15.3.2 (24D81)
Logs
places.js:50 As of March 1st, 2025, google.maps.places.Autocomplete is not available to new customers.
Please use google.maps.places.PlaceAutocompleteElement instead. At this time, google.maps.places.Autocomplete is not scheduled to be discontinued, but google.maps.places.PlaceAutocompleteElement is recommended over google.maps.places.Autocomplete.
While google.maps.places.Autocomplete will continue to receive bug fixes for any major regressions, existing bugs in google.maps.places.Autocomplete will not be addressed. At least 12 months notice will be given before support is discontinued.
Please see https://developers.google.com/maps/legacy for additional details and https://developers.google.com/maps/documentation/javascript/places-migration-overview for the migration guide. Error Component Stack
Yeah, that's a thing now.
You can make the warning-message go away by removing the places.Autocomplete object or replacing it with an implementation based on the new Places API. We already updated our autocomplete example to show the different ways you can go about implementing autocomplete functionality in your app with the newer APIs.
Alternatively, you might still be able to enable the legacy places API using this deeplink: https://console.cloud.google.com/apis/library/places-backend.googleapis.com
Could we not also have access to the https://developers.google.com/maps/documentation/javascript/examples/place-autocomplete-element#maps_place_autocomplete_element-typescript instance?
@paul-vd sure, see here: https://github.com/visgl/react-google-maps/blob/main/examples/autocomplete/src/components/autocomplete-webcomponent.tsx – but note that the component is currently only available in the alpha and beta versions of the Maps API. Also, I think the typings for the PlaceAutocompleteElement in @types/google.maps are still a bit off.
How necessary is it to migrate?
@Techsetter as long as you aren't worried about that warning message in the console, there is absolutely no need.
I would say, if that part of your functionality is already done and works, you can safely ignore it. There hasn't been a notice that the Autocomplete class is going to be removed. Even if there was, it would – per deprecation and removal policy – be at least a year until it is actually removed.
Yeah, that's a thing now. You can make the warning-message go away by removing the
places.Autocompleteobject or replacing it with an implementation based on the new Places API. We already updated our autocomplete example to show the different ways you can go about implementing autocomplete functionality in your app with the newer APIs.Alternatively, you might still be able to enable the legacy places API using this deeplink: https://console.cloud.google.com/apis/library/places-backend.googleapis.com
Note that the autocomplete example is not working on Code Sandbox due to a Node version issue:
error [email protected]: The engine "node" is incompatible with this module. Expected version "^20.19.0 || >=22.12.0". Got "20.9.0"