vue2-google-map fail to load library

I want to load geocode library with vue2-google-map component in my app.js

import * as VueGoogleMaps from "vue2-google-maps"
Vue.use(VueGoogleMaps, {
    load: {
        key: <my_api_key>,
        libraries: "places,geocode", 
        language: 'en',

at loading page I get 404 error net::ERR_ABORTED 404

My api key is enabled to get geocode library, from browser the request below works.<lat>,<lng>&key=<my_api_key>

1 answer

  • answered 2019-11-07 13:36 Giacomo

    Finally I was wrong to load geocode library in the initialization of component, to load geocode library I use $mapPromise method of component

       navigator.geolocation.getCurrentPosition(position => {
           this.$refs.gmap.$mapPromise.then(() => {
               let geocoder = new google.maps.Geocoder()
               let home = new google.maps.LatLng(position.coords.latitude, position.coords.longitude)
                   location: home
              function(geocoderResults) {
                  console.log('google result' , geocoderResults);