Skip to content

Application with a query that returns PageConnection with ApolloFederation fails to start #9798

@nathan-turnis

Description

@nathan-turnis

Product

Hot Chocolate

Version

16.0.9

Link to minimal reproduction

https://github.com/ChilliCream/graphql-platform/blob/1063f8bde76509c1e6cbf36e034a63cc40c51b21/src/HotChocolate/Core/src/Types/Types/Directives/DirectiveTypeInterceptor.cs

Steps to reproduce

  1. Set up GraphQL with .AddApolloFederation():
builder.Services.AddGraphQLServer()
.AddApolloFederation()
.AddTypes()
.AddFiltering()
.AddSorting()
.AddPagingArguments();
  1. Create query with paging
[QueryType]
public static partial class EmployeeResolver
{
      [UseConnection]
      public static async Task<PageConnection<Employee>> GetEmployeeByPageTest(AppDbContext db, QueryContext<Employee> query, PagingArguments args)
      {
          var page = await db.Employees.With(query).OrderByDescending(e => e.EmpId).ToPageAsync(args);
          return new PageConnection<Employee>(page);
      }
}
  1. Build and run applicationl; it crashes and fails to start.

What is expected?

The application runs and you can run the query with paging.

What is actually happening?

The application is crashing on startup.

Relevant log output

System.NullReferenceException: Object reference not set to an instance of an object.
   at HotChocolate.Types.DirectiveTypeInterceptor.RegisterDirectiveUsage(IDirectivesProvider member)
   at HotChocolate.Types.DirectiveTypeInterceptor.InspectType(TypeSystemObject obj)
   at HotChocolate.Types.DirectiveTypeInterceptor.OnAfterCompleteMetadata(ITypeCompletionContext context, TypeSystemConfiguration configuration)
   at HotChocolate.Configuration.AggregateTypeInterceptor.OnAfterCompleteMetadata(ITypeCompletionContext context, TypeSystemConfiguration configuration)
   at HotChocolate.Types.TypeSystemObject`1.OnAfterCompleteMetadata(ITypeCompletionContext context, TypeSystemConfiguration configuration)
   at HotChocolate.Types.TypeSystemObject`1.CompleteMetadata(ITypeCompletionContext context)
   at HotChocolate.Configuration.TypeInitializer.CompleteMetadata()
   at HotChocolate.Configuration.TypeInitializer.Initialize()
   at HotChocolate.SchemaBuilder.Setup.InitializeTypes(SchemaBuilder builder, IDescriptorContext context, IReadOnlyList`1 types)
   at HotChocolate.SchemaBuilder.Setup.Create(SchemaBuilder builder, LazySchema lazySchema, IDescriptorContext context)
   at HotChocolate.SchemaBuilder.Create(IDescriptorContext context)
   at HotChocolate.SchemaBuilder.HotChocolate.ISchemaBuilder.Create(IDescriptorContext context)
   at HotChocolate.Execution.RequestExecutorManager.CreateSchemaAsync(ConfigurationContext context, RequestExecutorSetup setup, RequestExecutorOptions executorOptions, IServiceProvider schemaServices, TypeModuleChangeMonitor typeModuleChangeMonitor, CancellationToken cancellationToken)
   at HotChocolate.Execution.RequestExecutorManager.CreateSchemaServicesAsync(ConfigurationContext context, RequestExecutorSetup setup, TypeModuleChangeMonitor typeModuleChangeMonitor, CancellationToken cancellationToken)
   at HotChocolate.Execution.RequestExecutorManager.CreateRequestExecutorAsync(String schemaName, Boolean isInitialCreation, CancellationToken cancellationToken)
   at HotChocolate.Execution.RequestExecutorManager.GetExecutorAsync(String schemaName, CancellationToken cancellationToken)
   at HotChocolate.AspNetCore.Warmup.RequestExecutorWarmupService.WarmupAsync(String schemaName, CancellationToken cancellationToken)
   at HotChocolate.AspNetCore.Warmup.RequestExecutorWarmupService.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__14_1(IHostedService service, CancellationToken token)
   at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions