Use
GqlExecutionContext.create(context).getContext().req to get the requestUse GqlExecutionContext. For GraphQL, the ExecutionContext holds the resolver arguments, not the HTTP request and response. GqlExecutionContext.create(context) converts it. The request is then on the GraphQL context, usually as req with the Apollo driver.
"Guards can't be used with GraphQL; use middleware instead" is wrong: guards fully work with resolvers. "Use context.switchToRpc().getData()" is wrong because switchToRpc() is for microservices.
Read more
- GraphQL quick start (https://docs.nestjs.com/graphql/quick-start)docs.nestjs.com
- Guards (https://docs.nestjs.com/guards)docs.nestjs.com