Hoppa till huvudinnehållet

Server workflow unexpected error in Format Date activity

Kommentarer

2 kommentarer

  • Alex St. John

    And If I just bypass the Format Date activity to feed the Unix epoch timestamp directly to the SQL insert, pictured below, I get the error, listed further below.

    {
      "start": "2023-06-28T19:04:40.7720798Z",
      "end": "2023-06-28T19:04:40.795218Z",
      "traces": [
        "Error: 0: Unexpected Error: VertiGIS.Workflow.Runtime.Execution.Exceptions.ActivityExecutionException: [WF: Activity execution error] Failed to execute activity 5 with action gcx:wf:server::SqlNonQuery: No mapping exists from object type Newtonsoft.Json.Linq.JValue to a known managed provider native type.",
        " ---> System.ArgumentException: No mapping exists from object type Newtonsoft.Json.Linq.JValue to a known managed provider native type.",
        "   at System.Data.SqlClient.MetaType.GetMetaTypeFromValue(Type dataType, Object value, Boolean inferLen, Boolean streamAllowed)",
        "   at System.Data.SqlClient.MetaType.GetMetaTypeFromType(Type dataType)",
        "   at System.Data.SqlClient.SqlParameter.GetMetaTypeOnly()",
        "   at System.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc)",
        "   at System.Data.SqlClient.SqlCommand.BuildParamList(TdsParser parser, SqlParameterCollection parameters)",
        "   at System.Data.SqlClient.SqlCommand.BuildExecuteSql(CommandBehavior behavior, String commandText, SqlParameterCollection parameters, _SqlRPC& rpc)",
        "   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)",
        "   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite, String method)",
        "   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName)",
        "   at System.Data.SqlClient.SqlCommand.BeginExecuteNonQuery(AsyncCallback callback, Object stateObject)",
        "   at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl(Func`3 beginMethod, Func`2 endFunction, Action`1 endAction, Object state, TaskCreationOptions creationOptions)",
        "   at System.Threading.Tasks.TaskFactory`1.FromAsync(Func`3 beginMethod, Func`2 endMethod, Object state)",
        "   at System.Data.SqlClient.SqlCommand.ExecuteNonQueryAsync(CancellationToken cancellationToken)",
        "--- End of stack trace from previous location ---",
        "   at VertiGIS.Workflow.Server.Activities.SqlNonQuery.ExecuteQuery(String provider, CancellationToken cancellationToken)",
        "   at VertiGIS.Workflow.Server.Activities.SqlQueryBase.Execute(IDictionary`2 inputs, IActivityContext context)",
        "   at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ExecuteActivityHandler(IActivityHandler handler, IDictionary`2 inputs)",
        "   --- End of inner exception stack trace ---",
        "   at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ExecuteActivityHandler(IActivityHandler handler, IDictionary`2 inputs)",
        "   at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ExecuteFinish(IActivityHandler handler, IDictionary`2 inputs)",
        "   at VertiGIS.Workflow.Runtime.Execution.ActivityContext.ExecuteStart()",
        "   at VertiGIS.Workflow.Runtime.Execution.AmbientState.ExecuteCurrentContext()",
        "   at VertiGIS.Workflow.Runtime.Execution.AmbientState.Execute()",
        "   at VertiGIS.Workflow.Runtime.Execution.Engine.Run(Program program, RunOptions options)",
        "   at VertiGIS.Workflow.Hosts.Server.Host.RunWorkflow(String workflowJson, IDictionary`2 inputs, IDictionary`2 trivia, String accessToken, String portalUrl, CancellationToken cancellationToken)",
        "   at VertiGIS.Workflow.Server.Foundation.WorkflowRunner.ProcessAsync(Object content)"
      ]
    }

    This error occurs whether I include the datetime field or not. So, it seems to be a more general SQL Server type error.

    I confirmed that all this had worked on June 19th, last week. Nothing was changed since then with the workflow, the mobile app config, the database, or the Studio server.

     

    UPDATE:

    • I found the cause to this issue, unrelated to the the datetime and Format Date issues.
    • It was because I was passing an object instead of a string.
    • I changed $getWorkflowInputs1.inputs.attributes["UID"] to parseInt($getWorkflowInputs1.inputs.attributes["UID"].toString()) in my insert parameters and it worked with the one UID field (excluded datetime and all other fields for now).
    • DISREGARD: It is stranger because this worked last week, but is there a better way to cast that because I expect UID to be an integer, but I have to do that big runaround of pass the integer as an object to the server workflow and then cast object -> string -> integer.
    • I found that using $getWorkflowInputs1.inputs.attributes["UID"].value gets the correct data type as well; that's more straightforward.
    1
  • Alex St. John

    Alright, turned out these issues are related. It is working now; I am passing my attributes to the server workflow and inserting records in a separate non-spatial database.

    When I pass the datetime to the Format Date activity, I need to append that .value to get the datetime out of the object.

    0

Du måste logga in om du vill lämna en kommentar.