Select to view content in your preferred language

ServiceFeatureTable Query Error - TaskStatusErrored - Invalid call - Object failed to load, unable to execute task.

1860
9
08-03-2022 06:01 PM
MKa
by
Frequent Contributor

My application uses a Service Feature Table to query our online feature service using a simple where clause.  This query has worked for nearly two years, but suddenly we intermittently get the TaskStatusErrored (Message - Invalid Call) (Additional Message - Object failed to load, unable to execute task).  This happens about every other call now.  I have looked at the service logs and don't see anything either.  Again this has worked for years, but suddenly it doesn't.  I don't know if it has anything to do with my new Appstudio 5.4 Cloud build Possibly, But everything else seems to work.  It returns TaskStatusErrored almost instantly.  You can see in my code below where I get the errors.  And I can do the same where clause and it works sometimes and not others.

 

Here is a summary of my code

//Declaration
property ServiceFeatureTable onlineFeatureTable

//This is setup in code
onlineFeatureTable = app.featureTable;

//This is done in code somewhere
onlineQueryID = onlineFeatureTable.queryFeaturesWithFieldOptions(fieldsQueryParameters, Enums.QueryFeatureFieldsLoadAll);

QueryParameters {
        id: fieldsQueryParameters
        whereClause: code = 'xyz' AND Year = '2022' AND iteration = '2' AND Group = '060'
        orderByFields: [
            OrderBy {
                fieldName: "xyzId"
                sortOrder: Enums.SortOrderAscending
            }
        ]
    }

Connections {
        target: onlineFeatureTable

        function onQueryFeaturesStatusChanged() {
            if (onlineFeatureTable.queryFeaturesStatus === Enums.TaskStatusCompleted) {
processQueryFeaturesResult(onlineFeatureTable.queryFeaturesResult);
            }
            else if (onlineFeatureTable.queryFeaturesStatus === Enums.TaskStatusErrored){ 
//It reaches this error about every other one now?               
                console.log("Error querying features: ", onlineFeatureTable.queryFeaturesResult);                
                console.log("onlineFeatureTable.error.message - ", onlineFeatureTable.error.message + "\n" + "\n");
                console.log("EonlineFeatureTable.error.additionalMessage - ", onlineFeatureTable.error.additionalMessage + "\n" + "\n");
                console.log("onlineFeatureTable.error.domain - ", onlineFeatureTable.error.domain + "\n" + "\n");
                console.log("onlineFeatureTable.error.errorType - ", onlineFeatureTable.error.errorType + "\n" + "\n");
                console.log("onlineFeatureTable.error.extendedErrorType - ", onlineFeatureTable.error.extendedErrorType + "\n" + "\n");
            }
            else if (onlineFeatureTable.queryFeaturesStatus === Enums.TaskStatusInProgress){
                console.log("TaskStatusInProgress - ", onlineFeatureTable.queryFeaturesStatus);
            }
            else
            {
                console.log("onlineFeatureTable - onQueryFeaturesStatusChanged Other - ", onlineFeatureTable.queryFeaturesStatus);
            }
        }
    }

 

0 Kudos
9 Replies
JamesBallard1
Esri Regular Contributor

@MKa, first I am sorry it's taken us a while to get back to you. I looked into this but I cannot reproduce it. I tested it with Runtime 100.14 on my mac but it always works. I am testing a slightly modified version of our FeatureLayer Query sample: https://github.com/Esri/arcgis-runtime-samples-qt/tree/main/ArcGISRuntimeSDKQt_QMLSamples/Features/F...

Are you able to provide any additional info about what is going wrong? My only recommendation without knowing what's specifically going wrong would be to wait for the ServiceFeatureTable to load before calling queryFeaturesWithFieldOptions.  Give that a try and let me know if that makes any difference.

0 Kudos
MKa
by
Frequent Contributor

I am wondering when the best time to check for isLoaded would be?  But I think some background would be necessary here.  My query is bringing back about 700 features all with full attributes and shapes.  I am wondering if the inital call gets immediatly rejected from the portal with that " Object failed to load" message?

0 Kudos
JamesBallard1
Esri Regular Contributor

@MKa unclear without more context. If a task is failing immediately, it is likely the ServiceFeatureTable has failed to load with some error.

0 Kudos
MKa
by
Frequent Contributor

I don't get the error everytime, but about every 4th time i get LoadStatusFailedToLoad on the feature table?  I don't know what changed that would all of a sudden make this happen.  I am getting all of my layers from a web map that I use to manage what layers I am working with.

0 Kudos
JamesBallard1
Esri Regular Contributor

I recommended reaching out to Esri support so we can help you more. There's nothing in your workflow that sounds too wild, and if it used to work consistently it should still be working.

For more debugging, I would add onLoadStatusChanged handlers to every loadable object with some console logging. Portal, Map, ServiceFeatureTable, etc... That way you should be able to pinpoint what is failing every fourth time and see if there is anything you can tweak in your code to get it working again.

I do still recommend reaching out to support. This sounds like something we should investigate.

0 Kudos
MKa
by
Frequent Contributor
So I loop through the operational layers of my map and get the layer I want
to work with. Then as you suggested i wait for it to load. Then i get the
LoadStatusFailedToLoad enum with the following message.

qLayer.loadError.message - You do not have permissions to access this
resource or perform this operation.
qLayer.loadError.errorType - 403

Again. I am using Oauth authentication and it works most of the time, but
about every 4th time i get this error and my app wont load. i have to
swipe it out to get the map to reload and the operationlayers to load again.
0 Kudos
JamesBallard1
Esri Regular Contributor

Very interesting. Can you share what version of the Runtime was working and the one that is now failing roughly every 4th time?

Also let me ask, does the app display any authentication dialog that is getting ignored or skipped? We recently addressed a bug in our authentication dialogs in our toolkit code. The issue was that in a stack view situation if you swipe away or otherwise dismiss the authentication dialog it would not properly cancel the challenge. Future requests would just fail and no longer challenge in these cases. It's a long shot, but worth mentioning.

https://github.com/Esri/arcgis-runtime-toolkit-qt/pull/539

 

0 Kudos
MKa
by
Frequent Contributor

We will look into that. This is happening on our old version too. Must be something on the backend. We have a federated portal to our secured services. We do see some 498 errors on the portal. Also when I hit one of these layers using postman and token I get “invalid token” every other time. Even though The token is still valid

0 Kudos
JamesBallard1
Esri Regular Contributor

Ok, thanks for the follow up info @MKa. Don't hesitate to reach out if you find any issues on the Runtime side of things.

0 Kudos