ionic-team / ionic-native-google-maps

Google maps plugin for Ionic Native
Other
221 stars 125 forks source link

Error on v4.15.0: Cannot read property 'indexOf' of undefined at Marker.normalize Arguments EventListener #161

Closed tunp88 closed 5 years ago

tunp88 commented 5 years ago

We are using v4.14.0 and the marker api works as well. However, when update to v4.15.0, the exception is showed: Cannot read property 'indexOf' of undefined at Marker.normalize Arguments EventListener

It seems that there is an issue at line 1356: _objectInstance.__pgmId in line 1356 in file ionic-native-google-maps/src/@ionic-native/plugins/google-maps/index.ts is undefined

wf9a5m75 commented 5 years ago

The latest version is 4.20.0

tunp88 commented 5 years ago

Thanks. I checked with version 4.20.0 and got the same problem. I'm moving back to version 4.14.0 and it works as well.

wf9a5m75 commented 5 years ago

Please share your project files on GitHub repository. Without valuable information, I can't check it

tunp88 commented 5 years ago

Sorry, It's our company project. I cannot share it here. But I could copy to you the stack trace: Uncaught TypeError: Cannot read property 'indexOf' of undefined at Marker.normalizeArgumentsOfEventListener (vendor.js:57856) at Marker. (vendor.js:57918) at Marker.trigger (:8080/plugins/cordova-plugin-googlemaps/www/BaseClass.js:71) at Map._onMarkerEvent (:8080/plugins/cordova-plugin-googlemaps/www/Map.js:1554) at Map.nativeCallback (:8080/plugins/cordova-plugin-googlemaps/www/js_CordovaGoogleMaps-for-android_ios.js:870) at :1:88 image

In my package.json, I use version 4.20.0: "@ionic-native/google-maps": "4.20.0",

This bug does not occur anymore when I move back to v4.14.0

I tried going to the lib code in node modules and update the if condition by adding checking undefined as below: image

Then, it works as before.

wf9a5m75 commented 5 years ago

Thank you for additional information, but important thing is that not source code position. That information is provided at first in your report.

I need to know how to reproduce the problem. It is depends on your code and cordova-plugin-googlemaps version.

If you can't share your code, you can still create a new simple project.

tunp88 commented 5 years ago

I updated my note above. My cordova-plugin-googlemaps: "cordova-plugin-googlemaps": "^2.4.6",

anisseb commented 5 years ago

npm install @ionic-native/google-maps@4.14.0 --save

in order to save in package.json

wf9a5m75 commented 5 years ago

ping

wf9a5m75 commented 5 years ago

Since nobody response for a while, I close this thread.

HenleyCoder commented 5 years ago

I had the same error where pgmId was undefined in normalizeArgumentsOfEventListener() I resolved the problem by removing the Cordova-plugin-googlemaps and reinstalling it. I believe the cause of the problem is that in version 2.5.0 of Cordova-plugin-googlemps changed the name of a variable from id to pgmId. Version 4.20.0 of Ionic-native-google-maps takes this into account. However, for reasons I don't understand, even though I had updated cordova-plugin-googlemaps to version 2.5.0, I found that the version of the cordova-plugin-googlemaps in the plugins folder had the old source code and so was still using the old variable name id. Hence removing and reinstalling the Cordova addin resolved the problem.