question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Console error on Marker click: maps.googleapis.com/maps/api/js?..callback=initMap - TypeError: Cannot read property 'apply' of null

See original GitHub issue

From 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:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
jinstercommented, Dec 7, 2020

I’ve also opened a bug ticket up with the Google Maps team here: https://issuetracker.google.com/issues/174839531

3reactions
jinstercommented, Dec 4, 2020

Got around this by specifying a version for now, hopefully Google fixes it soon:

const { isLoaded } = useLoadScript({
    googleMapsApiKey,
    version: '3.42.9',  //remove when Google fixes apply null bug
  });
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'apply' of undefined Google Maps ...
The error is a typo. I put the code below and commented //change in places where the typo was at. geocoder.geocode({}, callback) is...
Read more >
Error Messages | Maps JavaScript API - Google Developers
The Maps JavaScript API writes error and warning messages to the JavaScript console. Certain error conditions may also occur, which result in the...
Read more >
Cannot read property 'scale' of null" after dragging the map
Occasionally the exception "Uncaught TypeError: Cannot read property 'scale' of null" is thrown, but for the most part no exceptions show up in...
Read more >
React Google Maps Api Style Guide
Set this property to the number of markers to be processed in a single batch; select as high a number as you can...
Read more >
Step-by-step Guide On Calling Google Map Javascript API For ...
This is a step-by-step tutorial to call Google Map through API for ... <script defer src="<https://maps.googleapis.com/maps/api/js?key=** ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found