diff --git a/.changeset/stupid-moles-joke.md b/.changeset/stupid-moles-joke.md new file mode 100644 index 0000000000..7dee230fa7 --- /dev/null +++ b/.changeset/stupid-moles-joke.md @@ -0,0 +1,5 @@ +--- +'@backstage/catalog-client': patch +--- + +Avoid using Headers as it is not supported in the backend diff --git a/packages/catalog-client/src/CatalogClient.ts b/packages/catalog-client/src/CatalogClient.ts index 83d68742ee..7426aabaac 100644 --- a/packages/catalog-client/src/CatalogClient.ts +++ b/packages/catalog-client/src/CatalogClient.ts @@ -191,9 +191,9 @@ export class CatalogClient implements CatalogApi { options?: CatalogRequestOptions, ): Promise { const url = `${await this.discoveryApi.getBaseUrl('catalog')}${path}`; - const headers = new Headers( - options?.token ? { Authorization: `Bearer ${options.token}` } : {}, - ); + const headers: Record = options?.token + ? { Authorization: `Bearer ${options.token}` } + : {}; const response = await fetch(url, { method, headers }); if (!response.ok) { @@ -207,9 +207,9 @@ export class CatalogClient implements CatalogApi { options?: CatalogRequestOptions, ): Promise { const url = `${await this.discoveryApi.getBaseUrl('catalog')}${path}`; - const headers = new Headers( - options?.token ? { Authorization: `Bearer ${options.token}` } : {}, - ); + const headers: Record = options?.token + ? { Authorization: `Bearer ${options.token}` } + : {}; const response = await fetch(url, { method, headers }); if (!response.ok) { @@ -225,9 +225,9 @@ export class CatalogClient implements CatalogApi { options?: CatalogRequestOptions, ): Promise { const url = `${await this.discoveryApi.getBaseUrl('catalog')}${path}`; - const headers = new Headers( - options?.token ? { Authorization: `Bearer ${options.token}` } : {}, - ); + const headers: Record = options?.token + ? { Authorization: `Bearer ${options.token}` } + : {}; const response = await fetch(url, { method, headers }); if (!response.ok) {