Uncaught InvalidValueError: initMap is not a function

Found it... Though very late to the party...

If you downloaded the google maps js code from this link https://maps.googleapis.com/maps/api/js and then tried calling it using

<script async defer
  src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap">
</script>

There is bug in the development tools that the code gets modified.

Find the initMap in the downloaded file and replace whole file with "" Or replace with a fresh copy form the above link and then lock the file or mark it as ReadOnly to avoid the same in future.


I copied your code but there are some syntax error. So i can't test. But your error is about initMap (of course :)). Delete all code and check initMap and your window.initMap.

function initMap() {alert("ok");}

Is google callback works?