Uploaded image for project: 'FlightPath'
  1. FlightPath
  2. FLPATH-1111

Fix v2/instances endpoint

XMLWordPrintable

      Description of the problem:
       http://localhost:7007/api/orchestrator/v2/workflows/instances  is returning an error
      whereas http://localhost:7007/api/orchestrator/instances works fine.

      • `start` and `end` should be string because that's the way they are mapped after the graphql query (talking about usage on BE because FE is safe)
      • we need to consider in the mapToProcessInstanceDTO function that start and end might be null
      • the variables block in the function can be replaced by calling the parseWorkflowVariables function

      How reproducible:

      Send a GET request to http://localhost:7007/api/orchestrator/v2/workflows/instances 

      Actual results:

       

      {"error":{"name":"TypeError","message":"processInstance.start?.toUTCString is not a function","stack":"TypeError: processInstance.start?.toUTCString is not a function\n    at mapToProcessInstanceDTO (/home/y0n1/Projects/janus-idp-backstage-plugins/plugins/orchestrator-backend/src/service/api/mapping/V2Mappings.ts:121:35)\n    at <anonymous> (/home/y0n1/Projects/janus-idp-backstage-plugins/plugins/orchestrator-backend/src/service/api/v2.ts:86:36)\n    at Array.map (<anonymous>)\n    at V2.getInstances (/home/y0n1/Projects/janus-idp-backstage-plugins/plugins/orchestrator-backend/src/service/api/v2.ts:86:25)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at <anonymous> (/home/y0n1/Projects/janus-idp-backstage-plugins/plugins/orchestrator-backend/src/service/router.ts:377:7)\n    at OpenAPIBackend.handleRequest (/home/y0n1/Projects/janus-idp-backstage-plugins/node_modules/openapi-backend/src/backend.ts:299:27)"},"request":{"method":"GET","url":"/v2/workflows/instances"},"response":{"statusCode":500}} 

       

      Expected results:

      Same output of http://localhost:7007/api/orchestrator/instances

            jkilzi@redhat.com Jonathan Kilzi
            gciavarrini@redhat.com Gloria Ciavarrini
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: