Error when clicking a MapView

1048
1
Jump to solution
08-01-2017 06:22 AM
MarkosYeterawork2
New Contributor

I'm getting the following error when I click on a MapView. I'm using jsapi 4.4 

MapView.js:699 Uncaught TypeError: Cannot read property 'position' of undefined at Object.b.hitTest (https://js.arcgis.com/4.4/esri/views/MapView.js:699:292) at Object.c.hitTest (https://js.arcgis.com/4.4/esri/views/MapView.js:694:137) at https://js.arcgis.com/4.4/esri/views/MapView.js:735:50 at Array.map (native) at Object.c.hitTest (https://js.arcgis.com/4.4/esri/views/MapView.js:735:12) at Object._clickHandler (https://js.arcgis.com/4.4/init.js:2063:27) at https://js.arcgis.com/4.4/init.js:49:303 at a._callback (https://js.arcgis.com/4.4/esri/views/MapView.js:625:178) at c._handleEvent (https://js.arcgis.com/4.4/esri/views/MapView.js:560:71) at Object.eventCallback (https://js.arcgis.com/4.4/esri/views/MapView.js:556:401)

Tags (1)
1 Solution

Accepted Solutions
williampreston
New Contributor II

Just FYI for the next weary googler. Currently in 4.4, hitTest will fail with this error if any of your layers fail to properly load. In my case, a hosted feature service had an issue with a data store, and was in a state where it could not be queried with a where clause.  Because the hitTest method checks all layers, there is a hitTest method in the features view class which does not check for a null pointer, and therefore throws an uncaught error crashing the entire application.

View solution in original post

1 Reply
williampreston
New Contributor II

Just FYI for the next weary googler. Currently in 4.4, hitTest will fail with this error if any of your layers fail to properly load. In my case, a hosted feature service had an issue with a data store, and was in a state where it could not be queried with a where clause.  Because the hitTest method checks all layers, there is a hitTest method in the features view class which does not check for a null pointer, and therefore throws an uncaught error crashing the entire application.