When trying to utilize the orchestrator plugin, and running one of the create backend app workflows in the example workflow repository such as the spring-boot-backend workflow, the workflow will create the repository but will not be able to register the corresponding component. Instead it will output the following in the logs saying it's registering null into the catalog:
backend:start: 2024-02-02T18:33:29.380Z orchestrator info Registering null in the catalog
backend:start: 2024-02-02T18:33:29.389Z rootHttpRouter info ::1 - - [02/Feb/2024:18:33:29 +0000] "POST /locations HTTP/1.1" 400 - "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" type=incomingRequest
backend:start: 2024-02-02T18:33:29.413Z backstage error Request failed with status 500 {"error":{"name":"InputError","message":"request/body/target must be string","stack":"InputError: request/body/target must be string\n at <anonymous> (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/@backstage/backend-openapi-utils/src/stub.ts:42:10)\n at handleReturn (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express-promise-router/lib/express-promise-router.js:24:23)\n at /home/frkong/coding/janus-idp/backstage-showcase/node_modules/express-promise-router/lib/express-promise-router.js:55:9\n at Layer.handle_error (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/layer.js:71:5)\n at trim_prefix (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:326:13)\n at /home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:286:9\n at Function.process_params (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:346:12)\n at next (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:280:10)\n at Layer.handle_error (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/layer.js:67:12)\n at trim_prefix (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:326:13)\n at /home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:286:9\n at Function.process_params (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:346:12)\n at next (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:280:10)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"},"request":{"method":"POST","url":"/locations"},"response":{"statusCode":400}} type=errorHandler stack=Error: {"error":{"name":"InputError","message":"request/body/target must be string","stack":"InputError: request/body/target must be string\n at <anonymous> (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/@backstage/backend-openapi-utils/src/stub.ts:42:10)\n at handleReturn (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express-promise-router/lib/express-promise-router.js:24:23)\n at /home/frkong/coding/janus-idp/backstage-showcase/node_modules/express-promise-router/lib/express-promise-router.js:55:9\n at Layer.handle_error (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/layer.js:71:5)\n at trim_prefix (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:326:13)\n at /home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:286:9\n at Function.process_params (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:346:12)\n at next (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:280:10)\n at Layer.handle_error (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/layer.js:67:12)\n at trim_prefix (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:326:13)\n at /home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:286:9\n at Function.process_params (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:346:12)\n at next (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/express/lib/router/index.js:280:10)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"},"request":{"method":"POST","url":"/locations"},"response":{"statusCode":400}}
backend:start: at CatalogClient.addLocation (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/@backstage/catalog-client/src/CatalogClient.ts:325:13)
backend:start: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
backend:start: at Object.handler (/home/frkong/coding/janus-idp/backstage-showcase/node_modules/@backstage/plugin-scaffolder-backend/src/scaffolder/actions/builtin/catalog/register.ts:130:9)
backend:start: at ScaffolderService.executeAction (/home/frkong/coding/janus-idp/backstage-showcase/dynamic-plugins-root/orchestrator-backend/src/service/ScaffolderService.ts:99:11)
backend:start: at <anonymous> (/home/frkong/coding/janus-idp/backstage-showcase/dynamic-plugins-root/orchestrator-backend/src/service/router.ts:516:31)
Debugging the backend shows that the body field of the request req seems to have an invalid schema (contains the catalogInfoUrl field) when the schema for the action in the upstream has catalogInfoUrl be mutually exclusive with repoContentsUrl and catalogInfoPath:
This in turn breaks the logic for the catalog:register action in the scaffolder-backend, resulting in a nullcatalogInfoUrl field being passed as the target field for the addLocations function of the catalog-client.
Expected Behavior
The catalog entity is registered into the catalog without any issues
What are the steps to reproduce this bug?
Setup the orchestrator frontend and backend plugin into the backstage-showcase (I dynamically installed them)
Have a valid github app or github token with permissions to create repositories, edit workflows, and repository content
Describe the bug
When trying to utilize the orchestrator plugin, and running one of the create backend app workflows in the example workflow repository such as the
spring-boot-backend
workflow, the workflow will create the repository but will not be able to register the corresponding component. Instead it will output the following in the logs saying it's registeringnull
into the catalog:Debugging the backend shows that the
body
field of the requestreq
seems to have an invalid schema (contains thecatalogInfoUrl
field) when the schema for the action in the upstream hascatalogInfoUrl
be mutually exclusive withrepoContentsUrl
andcatalogInfoPath
:When testing with the regular scaffolder, the
body
field does not contain thecatalogInfoUrl
field. Used the sprint-boot-backend scaffolder action.This in turn breaks the logic for the
catalog:register
action in thescaffolder-backend
, resulting in anull
catalogInfoUrl
field being passed as thetarget
field for theaddLocations
function of thecatalog-client
.Expected Behavior
The catalog entity is registered into the catalog without any issues
What are the steps to reproduce this bug?
spring-boot-backend
workflowVersions of software used and environment
@janus-idp/backstage-plugin-orchestrator@1.3.0
@janus-idp/backstage-plugin-orchestrator-backend-dynamic@1.2.0