I know there are plenty of example around and multiple questions on stackoverflow but none of them helped me to find the issue.
The goal was to have an autocomplete with just the regions (they available types are here: https://developers.google.com/maps/documentation/javascript/supported_types?hl=it#table3)
I replicated a minimal example with this code:
<html lang="it">
<head>
<script async
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDBXQ0UdiwiaaaaaaaaaaaaaaWQo&libraries=places&callback=initMap">
</script>
<title>Test per google autocomplete</title>
</head>
<body>
<input id="store_locator_autocomplete" type="text" size="50">
<script>
function initMap() {
const googleAutocomplete = document.getElementById("store_locator_autocomplete");
const options = {
types: ["regions"],
};
const autocomplete = new google.maps.places.Autocomplete(googleAutocomplete, options);
}
</script>
</body>
</html>
which is like the minium to make this work. Turns out that i can't make this work. I've disabled all sort of restriction on my API_KEY (so no ip/domain neither api type) and yet i get the error. I'm 100% sure the billing thing is ok since i get no errors in console regarding the issue and another site of mine from the same google cloud console account works just fine for the javascript api + places api. The Javascript API and the places API are enable, this i'm 100% sure too, read sentence above
p.s. since i'm italian i'm leaving here the original translated message too to help others "Questa pagina non carica correttamente Google Maps."
I found out that
["(regions)"]
needs to be enclosed within parenthesis.