apache / incubator-kie-kogito-apps

Kogito Apps - Kogito is a cloud-native business automation technology for building cloud-ready business applications.
http://kogito.kie.org
Apache License 2.0
61 stars 127 forks source link

Enter field is null for node when event type is error #1960

Closed fjtirado closed 8 months ago

fjtirado commented 8 months ago

Describe the bug

Issue https://github.com/apache/incubator-kie-issues/issues/576 added a small change related with Node event types (a new stateEVENT_TYPE_ERROR. https://github.com/elguardian/kogito-apps/blob/d157e3a7595db61963c45d97173b22b02cbf335e/data-index/data-index-common/src/main/java/org/kie/kogito/index/event/mapper/ProcessInstanceNodeDataEventMerger.java#L72C13-L74C23 When the event is of this type, the enter field might be left empty, but according to graphql definition, enter is not nullable, causing this exception

Full Error as JSON
{
  "error": {
    "name": "CombinedError",
    "message": "[GraphQL] The field at path '/ProcessInstances[0]/nodes[7]/enter' was declared as a non null type, but the code involved in retrieving data has wrongly returned a null value.  The graphql specification requires that the parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on. The non-nullable type is 'DateTime' within parent type 'NodeInstance'\n[GraphQL] The field at path '/ProcessInstances[0]/nodes[8]/enter' was declared as a non null type, but the code involved in retrieving data has wrongly returned a null value.  The graphql specification requires that the parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on. The non-nullable type is 'DateTime' within parent type 'NodeInstance'",
    "graphQLErrors": [
      {
        "message": "The field at path '/ProcessInstances[0]/nodes[7]/enter' was declared as a non null type, but the code involved in retrieving data has wrongly returned a null value.  The graphql specification requires that the parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on. The non-nullable type is 'DateTime' within parent type 'NodeInstance'",
        "path": [
          "ProcessInstances",
          0,
          "nodes",
          7,
          "enter"
        ],
        "extensions": {
          "classification": "NullValueInNonNullableField"
        }
      },
      {
        "message": "The field at path '/ProcessInstances[0]/nodes[8]/enter' was declared as a non null type, but the code involved in retrieving data has wrongly returned a null value.  The graphql specification requires that the parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on. The non-nullable type is 'DateTime' within parent type 'NodeInstance'",
        "path": [
          "ProcessInstances",
          0,
          "nodes",
          8,
          "enter"
        ],
        "extensions": {
          "classification": "NullValueInNonNullableField"
        }
      }
    ],
    "response": {}
  },
  "request": {
    "method": "GET",
    "url": "/instances/b9af370f-b873-4191-a43a-2b50bfd9d0e3"
  },
  "response": {
    "statusCode": 500
  }
}

Expected behavior

Enter should be always filled

Actual behavior

Enter is null when even type is error

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Kogito version or git rev (or at least Quarkus version if you are using Kogito via Quarkus platform BOM)

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response