Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#877 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
冷清
技术栈
react, typescript
领域
api, frontend

调研方向

从 importLibrary 的存根实现和报告中提到的示例目录开始。在下载的 Google Maps 脚本过期后,使用 Chrome 本地覆盖重现缓存脚本场景,然后跟踪运行时错误和依赖项移除。完成的标准是理解未捕获错误,并在不破坏地图成功初始化的情况下处理受影响的加载路径。

由索引模型根据 Issue 内容生成。

描述

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
主要语言
TypeScript
星标
1.9k
派生
195
平均合并
2 天 18 小时
30 天内合并 PR
15

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

visgl/react-google-maps 的其他 Issue

查看 visgl/react-google-maps 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。