QueryTask unable to complete operation

Discussion created by xupla on Apr 3, 2014
Latest reply on Apr 3, 2014 by xupla
Basically I'm querying a feature layer to get the number of points in a specific polygon. I have the code working.

feature.on("click", function (evt) {
                    var highlightGraphic = new Graphic(evt.graphic.geometry, highlightSymbol);

                    var query = new Query();
                    var queryTask = new QueryTask("featurelayer");
                    query.geometry = evt.graphic.geometry;
                    query.returnGeometry = true;
                    query.outSpatialReference = map.spatialReference;
                    query.outFields = ["*"];                    

                    queryTask.execute(query, function (results) {                        


My problem is that in some specific polygons the count is not being worked out and I'm getting "unable to complete operation" error in the console of Chrome browser

_ssl: undefined
code: 400
details: Array[1]
httpCode: 400
log: undefined
message: "Unable to complete operation."
stack: (...)
get stack: function () { [native code] }
set stack: function () { [native code] }
__proto__: d

Any ideas why this is happening. I could not understand how in major of the polygons drawn the queryTask is working and in some I'm getting this error. Thanks for your help