• Resolved Machtnix

    (@hillyfov)


    Hi folks,

    I noticed the Google Maps block throwing an error in the console when the “Use Javascript API” option is active. It works fine when this option is disabled.

    This is how I encountered the error in WordPress 5.9 with Twentytwentytwo theme:

    1. Put the Google Maps block in a page. Enter a valid API key and save everything. Leave the “Use Javascript API” option disabled. The map shows up both in the editor and on the front end. Perfectly fine.
    2. Activate the option “Use Javascript API”. Save and update everything. The map does not show up on the front end anymore but is visible in the block editor. There is a blank space where the map would normally be.

    The error in developer tools console reads:

    Uncaught (in promise) 
    Object { message: "kbInitMaps is not a function", name: "InvalidValueError", stack: "ne@https://maps.googleapis.com/maps/api/js?key=[I-REMOVED-MY-API-KEY-HERE]&callback=kbInitMaps&ver=2.3.0:66:280\n_.pe@https://maps.googleapis.com/maps/api/js?key=[I-REMOVED-MY-API-KEY-HERE]&callback=kbInitMaps&ver=2.3.0:66:391\nBea@https://maps.googleapis.com/maps/api/js?key=[I-REMOVED-MY-API-KEY-HERE]&callback=kbInitMaps&ver=2.3.0:197:241\nCea/<@https://maps.googleapis.com/maps/api/js?key=[I-REMOVED-MY-API-KEY-HERE]&callback=kbInitMaps&ver=2.3.0:197:127\n" }

    Any ideas why?

    PS: I tried more than 1 Google Maps Javascript API key. None worked.

    • This topic was modified 2 years, 11 months ago by Machtnix.
Viewing 4 replies - 1 through 4 (of 4 total)
  • hannah

    (@hannahritner)

    Hi,
    Thanks for posting! Sorry to hear you’re experiencing this. I’ll check in with the dev team and see what insight they have. Can you post a link?

    Kindly,
    Hannah

    Thread Starter Machtnix

    (@hillyfov)

    Hello Hannah,

    thank you for looking into this.

    I created a WordPress Sandbox for you where you can see both the Google Maps block with “Use Javascript API” turned on and off.

    Visit sandbox
    Access code: 3813

    Please note that this sandbox will expire in 33 days from today.

    Thanks for posting, I can see how this can happen based on how the js is loaded. I’m adding in a dependency which should resolve the issue in the next update.

    Ben

    Thread Starter Machtnix

    (@hillyfov)

    Thank you, the update fixed the issue.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Google Maps block: kbInitMaps is not a function wit Javascript API option is on’ is closed to new replies.