diff --git a/.changeset/polite-apples-relax.md b/.changeset/polite-apples-relax.md new file mode 100644 index 0000000000..f6d10aaabf --- /dev/null +++ b/.changeset/polite-apples-relax.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +Fixed display of the location in the log message that is printed when entity envelope validation fails. diff --git a/plugins/catalog-backend/src/processing/ProcessorOutputCollector.ts b/plugins/catalog-backend/src/processing/ProcessorOutputCollector.ts index ff12f2f3db..cc3e1401bd 100644 --- a/plugins/catalog-backend/src/processing/ProcessorOutputCollector.ts +++ b/plugins/catalog-backend/src/processing/ProcessorOutputCollector.ts @@ -72,17 +72,17 @@ export class ProcessorOutputCollector { if (i.type === 'entity') { let entity: Entity; + const location = stringifyLocationRef(i.location); + try { entity = validateEntityEnvelope(i.entity); } catch (e) { assertError(e); - this.logger.debug(`Envelope validation failed at ${i.location}, ${e}`); + this.logger.debug(`Envelope validation failed at ${location}, ${e}`); this.errors.push(e); return; } - const location = stringifyLocationRef(i.location); - // Note that at this point, we have only validated the envelope part of // the entity data. Annotations are not part of that, so we have to be // defensive. If the annotations were malformed (e.g. were not a valid