diff --git a/.changeset/little-horses-end.md b/.changeset/little-horses-end.md new file mode 100644 index 0000000000..b7fe334973 --- /dev/null +++ b/.changeset/little-horses-end.md @@ -0,0 +1,5 @@ +--- +'@frontside/backstage-plugin-graphql-backend-module-catalog': patch +--- + +Corrects the request type used for extracting auth token for catalog requests. diff --git a/plugins/graphql-backend-module-catalog/src/entitiesLoadFn.ts b/plugins/graphql-backend-module-catalog/src/entitiesLoadFn.ts index 2ce2c54e64..7f0a24d3c9 100644 --- a/plugins/graphql-backend-module-catalog/src/entitiesLoadFn.ts +++ b/plugins/graphql-backend-module-catalog/src/entitiesLoadFn.ts @@ -3,7 +3,7 @@ import { Entity } from '@backstage/catalog-model'; import { getBearerTokenFromAuthorizationHeader } from '@backstage/plugin-auth-node'; import { GraphQLContext, NodeQuery } from '@frontside/hydraphql'; import { GraphQLError } from 'graphql'; -import type { Request } from 'express'; +import type { Request } from 'node-fetch'; import { CATALOG_SOURCE } from './constants'; export const createCatalogLoader = (catalog: CatalogApi) => ({ @@ -13,7 +13,7 @@ export const createCatalogLoader = (catalog: CatalogApi) => ({ ): Promise> => { // TODO: Support fields const request = context.request; - const token = request ? getBearerTokenFromAuthorizationHeader(request.headers.authorization) : undefined; + const token = getBearerTokenFromAuthorizationHeader(request?.headers.get('authorization')); const entityRefs = queries.reduce( (refs, { ref } = {}, index) => (ref ? refs.set(index, ref) : refs), new Map(),