-2

Google map was working and now asking require to change API key. After API key updation, it says

Array.from() with an implementation that doesn't support iterables, Google Maps JavaScript API v3 to not work correctly.

How it remove this bug?

4 Answers 4

7

It's possible we have the same issue.

You probably received a mail from google which annonce an API update.

We’re writing to let you know that the Maps JavaScript API will become unavailable to applications using non-compliant libraries, from the Maps JavaScript API version 3.54, releasing to the weekly channel in August 2023. ... Some third party libraries emulate newer JavaScript functionality, for browsers that may not support them natively. The Maps JavaScript API will start using some newer functionality in the ECMAScript standard, namely Array.from().

While Array.from() is available and working in all browsers supported by the Google Maps JavaScript API, some applications have code which replaces the working version of this with an invalid version from a library - creating an invalid JS environment. ... We have noticed that your application uses libraries incompatible with ECMAScript 2020, especially Array.from().

The first solution you can use is to specify the API version in the url. In that case, the earlier version from the update (april 2023), which is the 3.53.

It will look like that:

https://maps.googleapis.com/maps/api/js?key=xxxxxxxxxxxx&v=3.53

The default of this solution is that Google already announces its obsolescence:

For example, you can specify v=3.53 until April 2024, after which all Maps JavaScript versions will require a fix to your application.

Hope it will help. I will post again if I find a sustainable solution.

Axel

4
  • This is bang on. Thanks so much. I'm using Qualtrics which overrides Array.from(). Hopefully I can convince them to update their code ASAP! Commented Nov 16, 2023 at 20:35
  • 2
    We have been using the 3.53 version, however, we've now upgraded to the most recent version as we were able to override the Array.from using the following code: const iframe = document.createElement('iframe'); iframe.style.display='none'; document.body.appendChild(iframe); window.Array.from = iframe.contentWindow.Array.from; Commented Dec 11, 2023 at 21:46
  • Still facing the problem and using ScriptFiles.Add("maps.googleapis.com/maps/api/js?v=3.56&key=***********************");
    – testmap
    Commented May 29 at 13:59
  • Hi Jesse McMullen-Crummey can you help me on this
    – testmap
    Commented May 29 at 16:43
5

In my case, I had a conflict between Prototype.js and the new version of Google Maps API with the functionality Array.from().

So I have to use a local version on my website (because i usually use https://ajax.googleapis.com/ajax/libs/prototype), only call where is use a frame Google Maps and in that local version I change the line:

Array.from = $A;

To:

Array.from = Array.from || $A;

Hope it will help, Axel

2
  • Wow, that was my problem and a heck of a find. So glad to have come across this!!
    – Velocedge
    Commented Oct 6, 2023 at 15:29
  • Thanks, I had the same issue and this helped me solve my Issue
    – Fadd
    Commented Nov 20, 2023 at 15:12
1

For me it worked simply by adding the &v=3 parameter to

https://maps.googleapis.com/maps/api/js?sensor=true&libraries=places&key=MY_API_KEY&v=3

In your case it may work with another version depending on the environment you are working with.

It was Magento 1.9 for me

1

Axel's solution worked until April, after then I solved this issue by overriding Array.from following the code shown in your post's comments:

const iframe = document.createElement('iframe'); 
iframe.style.display='none'; 
document.body.appendChild(iframe); 
window.Array.from = iframe.contentWindow.Array.from; 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.