uber / cadence-web

Web UI for visualizing workflows on Cadence

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Loading workflow with SideEffect Fails

sdwr98 opened this issue · comments

Loading a workflow with a SideEffect in the history is failing with the following stack trace:

InvalidCharacterError: The string contains invalid characters.
atob
MarkerRecorded — summarize-events.js:74
getEventSummary — get-event-summary.js:19
(anonymous function) — get-history-events.js:34
map
(anonymous function) — index.vue:184
promiseReactionJob

It seems to be failing in this block:

    if (d.markerName === 'SideEffect') {
      return {
        data: JSON.tryParse(atob(details[1])) || details[1],
        'Side Effect ID': details[0],
      };
    }

And the relevant part of our workflow history is this:

            {
                "timestamp": "2020-04-06T20:34:06.035Z",
                "eventType": "MarkerRecorded",
                "eventId": 44,
                "details": {
                    "markerName": "SideEffect",
                    "details": [
                        0,
                        0,
                        0,
                        12,
                        112,
                        107,
                        -91,
                        -58,
                        -36,
                        72,
                        85,
                        -64,
                        12,
                        103,
                        -41,
                        115,
                        -88,
                        107,
                        -107,
                        -34,
                        -97,
                        124,
                        102,
                        -113,
                        -34,
                        -108,
                        -123,
                        -69,
                        -64,
                        51,
                        54,
                        -8,
                        -94,
                        36,
                        100,
                        113,
                        89,
                        -87,
                        -27,
                        -76,
                        -11,
                        -54
                    ],
                    "decisionTaskCompletedEventId": 43,
                    "header": null
                }
            },

Thanks!

Hi @sdwr98 , Running cadence-samples workflow
bin/mutex -m worker & bin/mutex -m trigger
I am able to run a workflow containing a SideEffect successfully.
Looking at the workflow history json, it looks like this has a different structure which may be what is causing your issue.

{
    "timestamp":"2020-06-11T17:23:06.788Z",
    "eventType":"MarkerRecorded",
    "eventId":6,
    "details": {
        "markerName":"SideEffect",
        "details":[
          0, "InVubG9jay1ldmVudC1TYW1wbGVXb3JrZmxvd1dpdGhNdXRleF8zZmI4Y2I4OS0zZDgzLTQ1ZDYtYjE2Ny05ZDgxODY1Y2FjMjUiCg=="
        ],
        "decisionTaskCompletedEventId":5,
        "header":null
    }
}

If you are able to somehow share more details of how you are getting this SideEffect which differs from the samples, then I'll be able to reproduce the same behavior and work on a relevant fix. My best guess is in the code it needs a try/catch on the atob function and default back to details[1] if it can't pass it. The only thing is there is way more arguments than just details[1] in your output workflow history which wouldn't be shown.

One other thing to ask is if you have tried running the same workflow in Cadence CLI to see if it has an issue parsing the history?

Are you using custom data converter for the workflow? @sdwr98
If so, that details for marker event is not encoded in json, and cadence UI may encounter error because of this. I think we can just ignore the json parse error and ouput the binary instead @just-at-uber