Home > database >  Intermittent JSON Unmarshalling Error when using serverless workflow go sdk
Intermittent JSON Unmarshalling Error when using serverless workflow go sdk

Time:07-28

i've got a repo https://github.com/BuilderHarrison/temporal-hello-world-dsl and when i run it, it fails 50% of the time and succeeds 50% of the time. I am very new to both temporal and the serverless sdk. So im unable to quite figure out how to proceed with debugging the issue. The issue im getting is:

{
  "type": "workflowExecutionFailedEventAttributes",
  "failure": {
    "message": "unable to decode the workflow function input payload with error: payload item 0: unable to decode: json: cannot unmarshal object into Go struct field Workflow.Start of type string, function name: HelloWorld",
    "source": "GoSDK",
    "stackTrace": "",
    "cause": {
      "message": "payload item 0: unable to decode: json: cannot unmarshal object into Go struct field Workflow.Start of type string",
      "source": "GoSDK",
      "stackTrace": "",
      "cause": {
        "message": "unable to decode: json: cannot unmarshal object into Go struct field Workflow.Start of type string",
        "source": "GoSDK",
        "stackTrace": "",
        "cause": {
          "message": "unable to decode",
          "source": "GoSDK",
          "stackTrace": "",
          "cause": null,
          "applicationFailureInfo": {
            "type": "",
            "nonRetryable": false,
            "details": null
          }
        },
        "applicationFailureInfo": {
          "type": "wrapError",
          "nonRetryable": false,
          "details": null
        }
      },
      "applicationFailureInfo": {
        "type": "wrapError",
        "nonRetryable": false,
        "details": null
      }
    },
    "applicationFailureInfo": {
      "type": "wrapError",
      "nonRetryable": false,
      "details": null
    }
  },
  "retryState": "RetryPolicyNotSet",
  "workflowTaskCompletedEventId": "7",
  "newExecutionRunId": ""
}

For reference the json file im providing is:

{
    "id": "helloworld",
    "version": "1.0",
    "specVersion": "0.8",
    "name": "Hello World Workflow",
    "description": "Hello World",
    "start": "Hello State",
    "states": [
      {
        "name": "Hello State",
        "type": "operation",
        "actionMode": "sequential",
        "actions": [
          {
            "functionRef": {
              "refName": "PrintHelloWorld1",
              "arguments": {
                "arg1": "Hello World1!"
              }
            }
          },
            {"functionRef": {
                "refName": "PrintHelloWorld2",
                "arguments": {
                  "arg1": "Hello World2!"
                }
              }
            }
        ],
        "end": true
      }
    ]
  }

Any assistance would be appreciated!

Cheers, Harrison

CodePudding user response:

The 50%-of-the-time errors are often due to the presence of two Worker processes, one of which is on an older / incompatible version of the code. Is there a chance you have an old Worker process in a different shell or in the background?

  • Related