Skip to content

Commit

Permalink
Fix v15
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Aug 26, 2024
1 parent d479db5 commit 3c6a7b7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/plugins/generic-auth/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { DefaultContext, Maybe, Plugin, PromiseOrValue } from '@envelop/core';
import { useExtendedValidation } from '@envelop/extended-validation';
import {
createGraphQLError,
getDefinedRootType,
getDirectiveExtensions,
shouldIncludeNode,
} from '@graphql-tools/utils';
Expand Down Expand Up @@ -354,9 +355,11 @@ export const useGenericAuth = <

let curr: any = args.document;
const operationAST = getOperationAST(args.document, args.operationName);
const operationType = operationAST?.operation ?? OperationTypeNode.QUERY;
let currType: GraphQLOutputType | undefined | null =
args.schema.getRootType(operationType);
const operationType = operationAST?.operation ?? ('query' as OperationTypeNode);
let currType: GraphQLOutputType | undefined | null = getDefinedRootType(
schema,
operationType,
);
for (const pathItem of path) {
curr = curr[pathItem];
if (curr?.kind === 'Field') {
Expand Down

0 comments on commit 3c6a7b7

Please sign in to comment.