When the catalog entity couldn't be found the /sync endpoint would return with a 404 and a JSON response which was not expected by the event-stream fetch on the frontend. This causes the client to continuously make requests to the /sync endpoint.
Signed-off-by: Alex Lorenzi <alorenzi@spotify.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-techdocs-backend': patch
|
||||
---
|
||||
|
||||
Modified response when catalog entity isn't found to resolve issue where `/sync` endpoint was continuously called
|
||||
@@ -242,14 +242,14 @@ export async function createRouter(
|
||||
targetPluginId: 'catalog',
|
||||
});
|
||||
|
||||
const entity = await entityLoader.load({ kind, namespace, name }, token);
|
||||
|
||||
if (!entity?.metadata?.uid) {
|
||||
throw new NotFoundError('Entity metadata UID missing');
|
||||
}
|
||||
|
||||
const responseHandler: DocsSynchronizerSyncOpts = createEventStream(res);
|
||||
|
||||
const entity = await entityLoader.load({ kind, namespace, name }, token);
|
||||
if (!entity?.metadata?.uid) {
|
||||
responseHandler.error(new NotFoundError('Entity metadata UID missing'));
|
||||
return;
|
||||
}
|
||||
|
||||
// By default, techdocs-backend will only try to build documentation for an entity if techdocs.builder is set to
|
||||
// 'local'. If set to 'external', it will assume that an external process (e.g. CI/CD pipeline
|
||||
// of the repository) is responsible for building and publishing documentation to the storage provider.
|
||||
|
||||
Reference in New Issue
Block a user