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

Orchestrator Backend plugin not handling 401 error correctly

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      Description of the problem:
      When configuring workflow to enforce token validity, if the validity check fails, the workflow returns a 401 error.

      But the BE plugin returns an irrelant error message:

      ➤ YN0000: [backend]: 2025-04-07T13:35:48.510Z orchestrator error request to endpoint /v2/workflows/token-propagation/execute failed with error: {}. Request headers: {"host":"localhost:7007","user-agent":"curl/8.6.0","accept":"*/*","content-type":"application/json","authorization":"Bearer ***","content-length":"1467"}. Request body: {"inputData":{},"authTokens":[{"provider":"First","token":"FIRST"},{"provider":"Other","token":"<expired token"},{"provider":"Simple","token":"SIMPLE"}]}. Request query: {} 
      ➤ YN0000: [backend]: 2025-04-07T13:35:48.511Z orchestrator error Request failed with status 500 Body is unusable type=errorHandler stack=TypeError: Body is unusable
      ➤ YN0000: [backend]:     at consumeBody (/usr/lib/node_modules_20/undici/lib/web/fetch/body.js:411:11)
      ➤ YN0000: [backend]:     at Response.json (/usr/lib/node_modules_20/undici/lib/web/fetch/body.js:334:14)
      ➤ YN0000: [backend]:     at SonataFlowService.executeWorkflow (/home/gabriel/git/parodos_stuff_v2/rhdh-plugins/workspaces/orchestrator/plugins/orchestrator-backend/src/service/SonataFlowService.ts:141:33)
      ➤ YN0000: [backend]:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      ➤ YN0000: [backend]:     at OrchestratorService.executeWorkflow (/home/gabriel/git/parodos_stuff_v2/rhdh-plugins/workspaces/orchestrator/plugins/orchestrator-backend/src/service/OrchestratorService.ts:199:9)
      ➤ YN0000: [backend]:     at V2.executeWorkflow (/home/gabriel/git/parodos_stuff_v2/rhdh-plugins/workspaces/orchestrator/plugins/orchestrator-backend/src/service/api/v2.ts:180:31)
      ➤ YN0000: [backend]:     at OpenAPIBackend.handleRequest (/home/gabriel/git/parodos_stuff_v2/rhdh-plugins/workspaces/orchestrator/node_modules/openapi-backend/src/backend.ts:303:27)
      ➤ YN0000: [backend]: 2025-04-07T13:35:48.512Z orchestrator error Error occured while requesting the '/v2/workflows/token-propagation/execute' endpoint actor=[object Object] meta=[object Object] request=[object Object] isAuditLog=true response=[object Object] eventName=executeWorkflowEndpointHit stage=completion status=failed errors=[object Object]
      

      As there was no JSON in the response, https://github.com/redhat-developer/rhdh-plugins/blob/6eecbea7d5827b148c44f67c474ae510d0a27203/workspaces/orchestrator/plugins/orchestrator-backend/src/service/SonataFlowService.ts#L134 is failing

      How reproducible:
      100%

      Steps to reproduce:

      1.Configure a workflow with token validity check

      2.Send a request to execute the workflow with invalid token

      3.

      Actual results:
      Fails without any relevant error message

      Expected results:
      Fails with a relevant error message to help the user make the right request

              ydayagi yaron dayagi
              rh-ee-gfarache Gabriel Farache
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: