Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jon R. Humphrey 164 posts 455 karma points c-trib
    Apr 15, 2018 @ 11:00
    Jon R. Humphrey
    0

    Google API Errors 'MissingKeyMapError' & 'NoApiKeys' on front end when back office datatypes report valid key?

    Jonathan, et al,

    The synopsis is I'm running into this issue on a clients site that's just gone live.

    Before repointing the live domain to the staging server (no comments please) everything worked fine.

    Please note, there are no http restrictions on any of the keys we've used.

    So we went live and the maps API threw the MissingKeyMapError and NoApiKeys errors so I hid the map on the front end while bug-checking.

    errors in console

    I changed the keys to newly generated ones

    updated keys

    Then the back office threw a hissy fit and told me the key was invalid:

    invalid key

    Note: At this time the console also told me that there was Uncaught reference error: google is not defined and Uncaught TypeError: Cannot read property 'maps' of undefined errors but these make sense as the key was working as expected.

    So I had the client generate a new one from their account and everything in the back office is green again!

    enter image description here

    BUT

    The front end is still showing the same errors?

    errors in console

    I've also tried to change the version of Maps being loaded but still receive the same error?

    v3.27

    v3.28

    Has anyone run into this before?

    Any ideas out be greatly appreciated!

    J

    N.B. There are Analytics and ReCaptcha running on this site too and no one has reported any issues with those Google services?

  • Alex Brown 129 posts 620 karma points
    Apr 20, 2018 @ 09:51
    Alex Brown
    0

    Have you got a snippet of your Razor code for the front-end?

  • Jon R. Humphrey 164 posts 455 karma points c-trib
    Apr 27, 2018 @ 12:20
    Jon R. Humphrey
    100

    @Alex, thanks for responding! I forgot to come back to update the issue as it turned out that the maps script wasn't actually using the Terratype loader but they're own custom javascript one - which wasn't passing the key to the api?

    Needless to say, I commented out their element that was targeted by the javascript and added the usual @Html.Terratype(mapAlias) to the template and low and behold it works!

    I'll mark this as the solution so we know it's sorted!

Please Sign in or register to post replies

Write your reply to:

Draft