You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot read property 'fromLatLngToDivPixel' of undefined #257
I saw this today too, locally, but just refreshed and it went away. It's definitely intermittent but I have no clue when/why it happens :\ Only happened to me once thus far.
TypeError
Cannot read property 'fromLatLngToDivPixel' of undefined
/assets/sources/pc_app-41d9587d14747b5803601f7937d20217e68a31a68be1a1cbed079760151ca726.js in apply at line 98459:39
var div = overlay.div;
var overlayProjection = overlay.getProjection();
var bounds = map.getBounds();
var ne = bounds.getNorthEast();
var sw = bounds.getSouthWest();
var ptx = overlayProjection.fromLatLngToDivPixel(new maps.LatLng(ne.lat(), sw.lng()));
// need round for safari still can't find what need for firefox
var ptxRounded = (0, _detect2.default)().isSafari ? { x: Math.round(ptx.x), y: Math.round(ptx.y) } : { x: ptx.x, y: ptx.y };
this_.updateCounter_++;
this_._onBoundsChanged(map, maps);
exception shows overlayProjection is undefined , so I read google maps reference and I found The projection is not initialized until onAdd is called by the API. in the document of getProjection() method of OverlayView instance.
I think getProjection() is called before onAdd is excecuted, and then overlayProjection is undefined and then got Cannot read property 'fromLatLngToDivPixel' of undefined.
I released a package called @mariusandra/google-map-react on NPM, which is google-map-react v0.24.0 plus a quick if (overlayProjection)hack in the hopes of fixing this bug.
I'm not sure if it works, but putting this out there for the adventurous to try.
Thanks @itsmichaeldiego for releasing a fix for this.
I'm upgrading to the 0.32.0 package now and as it's intermittent will report back as to whether it's fixed. We've seen 88 instances of this error logged in Raygun over the last week so I should know in a day or so.
Reacted by Paul, Patrik Krupar, Anthony Ascencio and pt-project
Haven't seen any new instances of this error since updating to 0.32.0 so I'm calling it fixed and will close this issue now. Thanks again for taking the time to fix this for us. :)
Activity
reintroducing commentedon Oct 28, 2016
I saw this today too, locally, but just refreshed and it went away. It's definitely intermittent but I have no clue when/why it happens :\ Only happened to me once thus far.
gabriel-laet commentedon Nov 23, 2016
Also noticing the same exception in production. I couldn't see a clear pattern between users, seems to affect all modern browsers as well.
yuya373 commentedon Dec 2, 2016
Hi! I have same exception. I got this.
exception shows
overlayProjectionisundefined, so I read google maps reference and I foundThe projection is not initialized until onAdd is called by the API.in the document ofgetProjection()method ofOverlayViewinstance.I think
getProjection()is called beforeonAddis excecuted, and thenoverlayProjectionisundefinedand then gotCannot read property 'fromLatLngToDivPixel' of undefined.Google Maps JavaScript API V3 Reference | Google Maps JavaScript API | Google Developers
google-map-react/google_map.js at 7a9a8d3fb7f3d1bf4409bddd326f2cc0545857cc · istarkov/google-map-react
sunkaflek commentedon Dec 3, 2016
same issue here. Unfortunately no clear pattern, happens "sometimes"
parth-vora-7 commentedon Mar 29, 2017
Hello,
Same for me too. Not found any clear pattern yet for this error. Did anyone ever fixed that?
Thanks
parth-vora-7 commentedon Mar 29, 2017
Hello,
I think I found the solution. Just use the latest version of the infobox.js:
https://github.com/googlemaps/v3-utility-library/blob/master/infobox/src/infobox.js
I was using version 1.0 before. After upgrading to the version 1.1.13, I'm not getting that error anymore.
Hope this will help someone.
Thanks
mariusandra commentedon Oct 3, 2017
I'm also occasionally seeing this reported by Bugsnag, but can never reproduce locally. Has anyone find something that could help?
I'm not sure I understand what InfoBox has to do with this?
mariusandra commentedon Oct 3, 2017
I released a package called
@mariusandra/google-map-reacton NPM, which is google-map-react v0.24.0 plus a quickif (overlayProjection)hack in the hopes of fixing this bug.I'm not sure if it works, but putting this out there for the adventurous to try.
nuclearspike commentedon Feb 17, 2018
I'm also seeing this in production. Any plan to apply something like @mariusandra 's solution to master?
fix error about fromLatLngToDivPixel
itsmichaeldiego commentedon Feb 20, 2018
@mariusandra You can totally create a PR and we'll merge it into our master, test it and release it 👍
@nuclearspike ^
fix error about fromLatLngToDivPixel (#517)
Bronsequences commentedon Mar 2, 2018
Thanks @itsmichaeldiego for releasing a fix for this.
I'm upgrading to the 0.32.0 package now and as it's intermittent will report back as to whether it's fixed. We've seen 88 instances of this error logged in Raygun over the last week so I should know in a day or so.
Bronsequences commentedon Mar 5, 2018
Haven't seen any new instances of this error since updating to 0.32.0 so I'm calling it fixed and will close this issue now. Thanks again for taking the time to fix this for us. :)
nuclearspike commentedon Mar 5, 2018
Thanks for getting this out. Upgrading now.
chore: Reset master to head commit of google-map-react/master (#5)
Reuse single map instance object (#6)