Console error on Marker click: maps.googleapis.com/maps/api/js?..callback=initMap - TypeError: Cannot read property 'apply' of null
See original GitHub issueFrom your Slack general channel today:
Bob 12:08 AM Hi guys, I would like to know if anyone else is facing the error shown on the image I’m attaching… this happens every time I click on a marker, using @react-google-maps/api v1.13.0 (screenshot with the same errors as below)
John 8:22 PM Hey everyone, Bob yes, we have the same error, I just joined because of this. It’s flooding our sentry.io reports, and I can also reproduce locally. For us this errors triggers when clicking on a marker. In our component that possibly re-renders the map because of a state change in the controlling component. I tried with replacing LoaderScript with useLoadScript ,that didn’t help. The error in text:
https://maps.googleapis.com/maps/api/js?key=<api..key>&v=weekly&callback=initMap
js?key=<api key>&v=weekly&callback=initMap:206 Uncaught TypeError: Cannot read property 'apply' of null
at of.H (js?key=AIzaSyDDzIS1_j6jqLkx_zkIT_FYP1L4dqgLsy0&v=weekly&callback=initMap:206)
at Object._.M.trigger (js?key=AIzaSyDDzIS1_j6jqLkx_zkIT_FYP1L4dqgLsy0&v=weekly&callback=initMap:203)
at xU.<anonymous> (marker.js:27)
at of.H (js?key=AIzaSyDDzIS1_j6jqLkx_zkIT_FYP1L4dqgLsy0&v=weekly&callback=initMap:206)
at Object._.M.trigger (js?key=AIzaSyDDzIS1_j6jqLkx_zkIT_FYP1L4dqgLsy0&v=weekly&callback=initMap:203)
at Object.onClick (marker.js:17)
at fp._.n.onClick (common.js:135)
at HTMLAreaElement.Ip.ua._.Uo.Tb (common.js:50)
(We also started to see anther error, not sure if it’s related:)
TypeError null is not an object (evaluating 'this.o.apply')
Bob 8:23 PM Thanks John we started to see this just recently as initially a few weeks ago everything was working fine and clicking the markers did not raise any errors on the console (edited) don’t know what has changed since we did not update or change anything the error does not stop the app from working but it is really annoying seeing all those error messages on the console was hoping someone from the dev team give us any possible explanations for the issue or workarounds could this be a breaking change on the Google Maps library side that is affecting this library?
John 8:27 PM same here, error log started happening today, but the component functions
Bob 8:27 PM This issue seems to also happen on this codesandbox demo: https://codesandbox.io/s/react-google-maps-api-ir5ks?file=/src/index.js:839-855 which I’m sure did not show the error a few weeks ago because thanks to that demo is how I found about this library and I’m sure that demo did not have any errors back then
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:8 (1 by maintainers)
I’ve also opened a bug ticket up with the Google Maps team here: https://issuetracker.google.com/issues/174839531
Got around this by specifying a version for now, hopefully Google fixes it soon: