Trouble executing a workflow from the Integration Gateway

Hello all!

I’m currently trying to execute a workflow using the integration gateway, I set up the workflow processor and selected my workflow, but every time I try to hit that route, I get the following error:

{
    "error": {
        "message": "could not exec workflow: workflow not found"
    }
}

I’ve double checked that the workflow is set up correctly, and have tried with all of the default corteza workflows, but the result is always the same.

This is the workflow I’m currently using:

{
  "workflows": [
    {
      "handle": "api2workflow",
      "enabled": true,
      "meta": {
        "name": "api2workflow",
        "description": "",
        "visual": null
      },
      "keepSessions": 0,
      "steps": [
        {
          "stepID": "4",
          "kind": "termination",
          "ref": "",
          "arguments": null,
          "results": null,
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "4",
              "parent": "1",
              "value": "Process Complete",
              "xywh": [
                3488,
                1960,
                200,
                80
              ]
            }
          }
        },
        {
          "stepID": "19",
          "kind": "function",
          "ref": "logError",
          "arguments": [
            {
              "target": "message",
              "expr": "payload",
              "type": "String"
            }
          ],
          "results": [],
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "19",
              "parent": "1",
              "value": "Log Payload",
              "xywh": [
                2488,
                2208,
                200,
                80
              ]
            }
          }
        },
        {
          "stepID": "25",
          "kind": "function",
          "ref": "jsenvExecute",
          "arguments": [
            {
              "target": "scope",
              "expr": "payload",
              "type": "Any"
            },
            {
              "target": "source",
              "value": "var data\n\ntry {\n\tdata = JSON.parse(input)\n} catch (e) {\n\tthrow new Error('could not parse user info payload: ' + e)\n}\n\nreturn data",
              "type": "String"
            }
          ],
          "results": [
            {
              "target": "MyData",
              "expr": "resultAny"
            }
          ],
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "25",
              "parent": "1",
              "value": "Serialize JSON and return MyData",
              "xywh": [
                2856,
                2208,
                200,
                80
              ]
            }
          }
        },
        {
          "stepID": "28",
          "kind": "function",
          "ref": "logError",
          "arguments": [
            {
              "target": "message",
              "expr": "MyData.foo",
              "type": "String"
            }
          ],
          "results": [],
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "28",
              "parent": "1",
              "value": "Log MyData.foo",
              "xywh": [
                3216,
                2208,
                200,
                80
              ]
            }
          }
        }
      ],
      "paths": [
        {
          "parentID": "19",
          "childID": "25",
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "26",
              "parent": "1",
              "points": [],
              "style": "exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;",
              "value": null
            }
          }
        },
        {
          "parentID": "25",
          "childID": "28",
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "29",
              "parent": "1",
              "points": [],
              "style": "exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;",
              "value": null
            }
          }
        },
        {
          "parentID": "28",
          "childID": "4",
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "30",
              "parent": "1",
              "points": [],
              "style": "exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;",
              "value": null
            }
          }
        }
      ],
      "triggers": [
        {
          "resourceType": "system",
          "eventType": "onManual",
          "constraints": [
            {
              "name": "",
              "op": "=",
              "values": [
                ""
              ]
            }
          ],
          "enabled": true,
          "stepID": "19",
          "meta": {
            "description": "",
            "visual": {
              "edges": [
                {
                  "childID": "19",
                  "meta": {
                    "description": "",
                    "label": "",
                    "visual": {
                      "id": "20",
                      "parent": "1",
                      "points": [],
                      "style": "exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;",
                      "value": null
                    }
                  },
                  "parentID": "3"
                }
              ],
              "id": "3",
              "parent": "1",
              "value": "API POST ",
              "xywh": [
                2224,
                1960,
                200,
                80
              ]
            }
          }
        }
      ]
    }
  ]
}

Any help would be greatly appreciated!

What version are you using and are there any errors in the Docker logs?

I’m using version 2021.9.6, this is the error that shows up in the server {"level":"error","ts":1654778443.2960813,"msg":"could not exec workflow: workflow not found","route":"GET /hello"}

EDIT: I should also add that at this moment, there is no convenient way for me to switch to the newest version of Corteza

EDIT 2: I’ve been trying to do debug some of the corteza-server scripts, and I found that in in ./automation/service/workflow.go, when the workflow gets executed on line 540, svc.cache is empty, even though the method above it “updateCache” (line 527) seems to be succesfully running and writing to svc.cache. Any idea what could be causing this? Is this the expected behaviour?

Integration gateway - workflow integration was broken for a few patches (I think it was on 2021.9.6 and fixed on the 2021.9.7 but don’t quote me on it).
Sorry, but the only solution here is to upgrade.