All Apps and Add-ons

API key required for Google Maps Add-on

sc0tt
Builder

We have an internal dashboard that has been using the Google Maps app. We are now getting the below message:

Oops! Something went wrong.
This page didn't load Google Maps correctly. See the JavaScript console for technical details.

The Javascript console shows "Google Maps API error: MissingKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error";

It seems that Google now requires an API.
Have others encountered this?

Where exactly should the key be added in the app?

sc0tt
Builder

For some unknown reason, this error has gone away and the maps now loads normally (6.2).
Since I haven't tested any of the given answers, I'll just vote for them and leave the question unanswered.

0 Karma

pjpmccarthy
Engager

All,

This got me most of the way there. I'm running Splunk v6.4.2 and from what I have read Google Maps is not officially supported under v6. I attempted the above fix but the maps would not load but instead hung on "Initializing maps". After looking through some browser console output I saw that the initMap function was not found. I then changed the s.src string to this:

s.src = "https://maps.googleapis.com/maps/api/js?key=API_KEY&callback=_gmapsOnLoad";

Maps now load and I'm able to map the source IPs of my firewall drops onto a map. Very cool!

laudai
Path Finder

thank you , it is bother me long time

0 Karma

ragedsparrow
Contributor

Hey sc0tt! I think I may have found it. I was troubleshooting the same issue you were as well. Here is what fixed it to me.

You have to modify the GoogleMaps.js file at $SPLUNK_HOME/maps/appserver/modules/GoogleMaps/

Look for this line in the javascript file:

s.src = "//maps.google.com/maps/api/js?sensor=false&version=v3.6&callback=_gmapsOnLoad";

Replace it with:

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

You will need to have an API Key already to insert in the link, but it should work. I was able to load the Google Maps after I replaced this and restarted Splunk.

Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...