function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ravi Dutt SharmaRavi Dutt Sharma 

Issue with lightning:map

Winter 19 release has brought this new tag - lightning:map to show google maps in lightning maps. I am trying to implment below example in my dev org, but the map marker is not showing up on the org.

Example given here:https://developer.salesforce.com/docs/component-library/bundle/lightning:map/example

When I check the broswer console, I can see below error:

util.js:218 Google Maps JavaScript API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys
lw.j @ util.js:218
(anonymous) @ js?key=&callback=LightningPrimitiveMap.init:183
(anonymous) @ js?key=&callback=LightningPrimitiveMap.init:76
(anonymous) @ js?key=&callback=LightningPrimitiveMap.init:73
(anonymous) @ js?key=&callback=LightningPrimitiveMap.init:76
(anonymous) @ js?key=&callback=LightningPrimitiveMap.init:164
(anonymous) @ js?key=&callback=LightningPrimitiveMap.init:76
(anonymous) @ js?key=&callback=LightningPrimitiveMap.init:164
Ee @ js?key=&callback=LightningPrimitiveMap.init:75
Ae.xa @ js?key=&callback=LightningPrimitiveMap.init:164
(anonymous) @ stats.js:1
util.js:218 Google Maps JavaScript API warning: InvalidKey https://developers.google.com/maps/documentation/javascript/error-messages#invalid-key

Question1: Do we need to explicitly add google map api key? Only then the map would work? I am assuming that Salesforce should automatically take care of this?
Question 2: If the answer to above question in yes, then how do we add the api key? I have a developer key, but not sure how to add it.
Gulafsha MohammedGulafsha Mohammed
A lightning:map component securely displays a map of one or more locations. This component requires API version 44.0 and later. Make sure that your api version is correct.
If this has solved your problem then please mark this as best answer.
Ravi Dutt SharmaRavi Dutt Sharma
If API version is not 44, it gives you a compile time error.
Gullu SfGullu Sf
Hi @Ravi Dutt Sharma, Recently, I too developed google maps component using Lightning:map, Initially, I was able to view marker for Account on google maps. But since last week I'm getting Error that says "Oops Something Wrong with Google Maps, Please check javascript console". When I checked, the error code stated "UnauthorizedURLForClientIdMapError". I'm also stuck at how to pass the Google maps API key to the lightning:Map component. When I checked the Salesforce Developer Guide, it says include the API Key in a script tag. But how can we include it in the lightning component? No documentation on this, Or maybe I'm missing something. Please post it if you find any solution.