Merge pull request #28832 from backstage/techdocs-entity-notfound-sync-fix

fix(techdocs): /sync response when entity not found
This commit is contained in:
Alex Lorenzi
2025-02-13 14:35:54 -05:00
committed by GitHub
3 changed files with 16 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs-backend': patch
---
Fixed issue `syncEntityDocs` that would cause the `/sync` endpoint to be continuously called if the request fails
+10 -2
View File
@@ -180,7 +180,11 @@ describe('TechDocsStorageClient', () => {
mockFetchEventSource.mockImplementation(async (_url, options) => {
const { onerror } = options;
onerror?.(new NotFoundError('Some not found warning'));
try {
onerror?.(new NotFoundError('Some not found warning'));
} catch (e) {
// do nothing
}
});
// we await later after we emitted the error
@@ -202,7 +206,11 @@ describe('TechDocsStorageClient', () => {
mockFetchEventSource.mockImplementation(async (_url, options) => {
const { onerror } = options;
onerror?.(new Error('Some other error'));
try {
onerror?.(new Error('Some other error'));
} catch (e) {
// do nothing
}
});
await expect(promise).rejects.toThrow(Error);
+1
View File
@@ -236,6 +236,7 @@ export class TechDocsStorageClient implements TechDocsStorageApi {
onerror(err) {
ctrl.abort();
reject(err);
throw err; // rethrow to stop the operation
},
});
});