NotLoadingAPIFromGoogleMapsError even when loading correct URL

房东的猫 提交于 2021-02-07 17:10:53

问题


I am getting the NotLoadingAPIFromGoogleMapsError error for some users even if the correct URL is being used: (pug syntax):

script(type='text/javascript' src='https://maps.googleapis.com/maps/api/js?key=MY_KEY&libraries=places')

It seems to be resulting from the Authentication API call generated from the script. Anyone else have this issue? How did you solve it?


回答1:


Hopefully others will find this useful - I received an answer from Google as follows:

The API session token expires if someone leaves a map open for more than about 24 hours, so it's normal to see a low level of these errors. (This is the intended behavior)

There's no documentation about this anywhere - so hopefully this answer will help save people research time.

There might be a way to catch the error and re-authorize if it occurs. I'll update here if that's a possibility.




回答2:


I had this issue for my site before and it was because of my service worker cache the google map API script. Once I unregistered my service worker the error stopped.




回答3:


I just saw this error on my site. See https://developers.google.com/maps/documentation/javascript/error-messages, which says the following. Was was using python webassets to include the google maps javascript in a merged file, that appears to have caused this response. Interestingly, I had this merged file for a while, and the error response was something new.

NotLoadingAPIFromGoogleMapsError
       The script element that loads the Maps JavaScript API is not being included correctly
       on your page. In order for the API to work correctly, it must be loaded directly from 
       https://maps.googleapis.com.


来源:https://stackoverflow.com/questions/54205790/notloadingapifromgooglemapserror-even-when-loading-correct-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!