dburles / meteor-google-maps

🗺 Meteor package for the Google Maps Javascript API v3
https://atmospherejs.com/dburles/google-maps
MIT License
196 stars 48 forks source link

MissingKeyMapError with Meteor and React #138

Closed JMAsoftworks closed 7 years ago

JMAsoftworks commented 7 years ago

How can I solve this problem? After showing the map, no more than 1 second it will show an error, Oops! Something went wrong. Then in the console, Google Maps API error: MissingKeyMapError appeared.

rlora commented 7 years ago

I have an app where the component works as expected. But another one in which the map crashes after 1s showing that error. I haven't found the root cause yet, I'm inclined to believe that it is something about Google. Given that package does not use an api key, probably if the domain is registered in Google console it acts differently. Will post more if I solve the issue.

rlora commented 7 years ago

Ok. I think is because of this: https://maps-apis.googleblog.com/2016/06/building-for-scale-updates-to-google.html

Starting 2016/06 all apps using Google Maps need an API Key. Look at the code, when you are loading the library you can pass an options hash. If it contains the key it should be included in the URL. As in: https://developers.google.com/maps/documentation/javascript/tutorial#Loading_the_Maps_API

That should work. I will confirm when I allocate some time to look at the app that I have crashing.

dburles commented 7 years ago

You can add an API key just check the docs under load

rlora commented 7 years ago

@dburles Yes! Thank you, works as expected by adding the api key in the options object.