Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Bug] Internal script error when Google Maps API is loaded from user cache

Aperta
#877 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
react, typescript
Ambito
api, frontend

Direzione di ricerca

Inizia dall’implementazione dello stub importLibrary e dalla directory di esempio menzionata nel report. Riproduci il caso dello script memorizzato nella cache usando una sostituzione locale di Chrome dopo la scadenza dello script Google Maps scaricato, quindi traccia l’errore di runtime e la rimozione della dipendenza. Il lavoro è completato quando l’errore non intercettato è compreso e il percorso di caricamento interessato viene gestito senza interrompere l’inizializzazione corretta della mappa.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Description

This is an interesting error. We get about 400 instances daily with a high traffic site- considered pretty low frequency.

Error: Google Maps JavaScript API error: NotLoadingAPIFromGoogleMapsError https://developers.google.com/maps/documentation/javascript/error-messages#not-loading-api-from-google-maps-error.

Commonalities:

  • Browser-cached instance of the Google Maps API is loaded
  • Error is thrown on a successful load, during runtime
  • Common error is in:
    https://maps.googleapis.com/maps-api-v3/api/js/61/14/main.js
    TypeError: Cannot read properties of undefined (reading 'getRootNode')
    ^ Likely because the internal map element has suddenly been removed from the DOM by another script included by google.

Why it's an issue:

  • Standard errors in requesting the google maps API are handled, this is uncaught due to google.maps dependencies suddenly being deleted from the global scope- as a result of the above error. After the script is loaded and dependencies are requested, and after the map has initialized in the DOM.

Area of current interest:
My current guess is that it's a race condition in the importLibrary stub implementation, that's an issue specifically when the core maps library is loaded immediately due to the cache and the cache is considered "outdated" by googles definition somewhere in their importLibrary (or similar) implementation.

Steps to Reproduce

This is difficult.

  • Download a copy of:
    https://maps.googleapis.com/maps/api/js?key={YOUR_KEY_HERE}&language=en&region=GB&libraries=core%2Cmaps%2Cgeometry&solution_channel=GMP_visgl_rgmlibrary_v1_default&loading=async&callback=__googleMapsCallback__
    (with your API key)
  • Wait. This version of the script will expire at some point, my best guess at the moment is > 24hrs, but not sure yet.
  • Use a local override to override the content of the script on an /example directory or similar
Environment
  • Library version: ^1.7.1
  • Google maps version: weekly
  • Browser and Version: Chrome, Safari, Edge - any and all versions
  • OS: Linux, iOS, macOS, Android, Windows - any and all
Logs
Google Maps JavaScript API error: NotLoadingAPIFromGoogleMapsError
https://developers.google.com/maps/documentation/javascript/error-messages#not-loading-api-from-google-maps-error
Lingua principale
TypeScript
Stelle
1.9k
Fork
195
Merge medio
2g 18h
PR unite (30g)
15

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di visgl/react-google-maps

Tutte le issue di visgl/react-google-maps

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.