Maps Javascript API – InvalidValueError on refresh

On wordpress with Sage 9 theme, enqueueing the script as follows

wp_enqueue_script('google-maps', 'https://maps.googleapis.com/maps/api/js?key=' . $_ENV['GOOGLE_MAPS_API'] . '&loading=async&callback=initMap&libraries=marker,places&v=beta', [], null, true);

and creating a map like this

function initMap() {
    map = new google.maps.Map(document.getElementById("map"), {
        center: { lat: 34, lng: 150 },
        zoom: 8,
    });
}

On refreshing the page I get this error in console

Uncaught (in promise) InvalidValueError

without any additional hint.

Landing on the page I can load the map.
I cannot trace back to the problem.

How can I debug this?