public_maps.min.js causing Perch Maps to fail

  • We've an anomaly where our public_maps.min.js file is causing Perch Maps to fail. Suspect its something in the code that we are missing.


    The browser throws an error about multiple Maps API calls and blocks the map from showing properly.


    If we remove the file from our hosting server the maps work fine however. This is code inherited from a previous developer so apologies if the issue is obvious.


    File is as attached. Anyone come across this?

  • George G

    Approved the thread.
  • Thanks Clive, appreciated. It's definitely something in the script as the Google maps show correctly when we rename public_maps.min.js to public_maps.min.bak.


    The browser throws an error in devtools but aesthetically all works well on the page.


    Is public_maps.min.js a part of the core Runway release or something that the previous developer has written as a custom script?

  • The example you posted actually looks the same as the script that is in core. However, without knowing what's been done in the rest of your site, I can't say for sure why you are getting the error.


    If you check the Perch config file, you will be able to see if a custom script is used.


    You need to make sure that you are defining a Google Maps API key (in the Perch config file) and that you have the appropriate Google Maps APIs in your Maps developer account. Last time I used this, the Maps JavaScript API and Maps Static API were needed. And check that the Google Maps developer account is set-up with the appropriate referrer URLs.

    If you have no knowledge of Google Maps Developer account, then it's probably with your developer and you will need to check that with him/her.


    You will need a Google Maps Developer account for this to work. That wasn't a requirement but it is now.