serverlessworkflow / sdk-go

Go SDK for Serverless Workflow
http://serverlessworkflow.io
Apache License 2.0
91 stars 35 forks source link

Intermittent JSON Unmarshalling Error #61

Closed BuilderHarrison closed 2 years ago

BuilderHarrison commented 2 years ago

What is the question: Hello, 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 refrence 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

ricardozanini commented 2 years ago

Hi @BuilderHarrison, thanks for opening this issue.

I'm unfamiliar with temporal, so I can't help much there. Can you isolate the error to the SDK only? Please use the example in our README with your workflow input to determine if the problem is related to this SDK.

tsurdilo commented 2 years ago

Check the data you pass as input to your wf exec. it has to be serializable to json by default

BuilderHarrison commented 2 years ago

Thanks for the assistance guys. Fortunately, it was a rogue temporal worker process that was still running in the background for an old piece of code. After restarting the temporal cluster this problem went away.