Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using user context with GraphQL Server? #213

Open
AzureMarker opened this issue Jan 24, 2021 · 0 comments
Open

Using user context with GraphQL Server? #213

AzureMarker opened this issue Jan 24, 2021 · 0 comments
Assignees

Comments

@AzureMarker
Copy link

AzureMarker commented Jan 24, 2021

I was trying out the library and found that there doesn't seem to be a good way to use it with GraphQL Server and access the user context that that library provides (via AddUserContextBuilder).

This Conventions library seems to only take in the context once you create an executor, but that's handled internally by the Server library. I would expect that the Conventions library would have some way to either mark or recognize a parameter as provided by an internal process like the Server library. Maybe there needs to be an explicit integration package between Conventions and Server.

With this branch of my project I get the following error on startup:

Unhandled exception. System.ArgumentOutOfRangeException: A type name can not be null or empty. (Parameter 'name')
   at GraphQL.Utilities.NameValidator.ValidateNameNotNull(String name, String type) in /_/src/GraphQL/Utilities/NameValidator.cs:line 31
   at GraphQL.Utilities.NameValidator.ValidateName(String name, String type) in /_/src/GraphQL/Utilities/NameValidator.cs:line 13
   at GraphQL.Types.GraphType.SetName(String name, Boolean validate) in /_/src/GraphQL/Types/GraphType.cs:line 49
   at GraphQL.Types.GraphType.set_Name(String value) in /_/src/GraphQL/Types/GraphType.cs:line 65
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.ConstructType[TReturnType](Type template, GraphTypeInfo typeInfo)
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.ConstructInputType(GraphTypeInfo typeInfo)
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.GetComplexType(GraphTypeInfo typeInfo)
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.DeriveType(GraphTypeInfo typeInfo)
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.GetType(GraphTypeInfo typeInfo)
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.DeriveField(GraphFieldInfo fieldInfo)
   at System.Linq.Enumerable.SelectListIterator`2.MoveNext()
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.DeriveFields(GraphTypeInfo typeInfo, IComplexGraphType graphType)
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.ConstructInterfaceType(GraphTypeInfo typeInfo)
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.GetComplexType(GraphTypeInfo typeInfo)
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.DeriveType(GraphTypeInfo typeInfo)
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.GetType(GraphTypeInfo typeInfo)
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.DeriveArgument(GraphArgumentInfo argumentInfo)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at GraphQL.Types.QueryArguments..ctor(IEnumerable`1 list) in /_/src/GraphQL/Types/QueryArguments.cs:line 20
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.DeriveField(GraphFieldInfo fieldInfo)
   at System.Linq.Enumerable.SelectListIterator`2.MoveNext()
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.DeriveFields(GraphTypeInfo typeInfo, IComplexGraphType graphType)
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.ConstructOutputType(GraphTypeInfo typeInfo)
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.GetComplexType(GraphTypeInfo typeInfo)
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.DeriveType(GraphTypeInfo typeInfo)
   at GraphQL.Conventions.Adapters.GraphTypeAdapter.DeriveSchema(GraphSchemaInfo schemaInfo)
   at GraphQL.Conventions.Builders.SchemaConstructor`2.Build(TypeInfo[] schemaTypes)
   at GraphQL.Conventions.Builders.SchemaConstructor`2.Build(Type[] schemaTypes)
   at GraphQL.Conventions.GraphQLEngine.BuildSchema(SchemaPrinterOptions options, Type[] types)
   at GraphQL.Conventions.GraphQLEngine.BuildSchema(Type[] types)
   at Forte.NET.Startup.ConfigureServices(IServiceCollection services) in /home/mark/media/Forte/Forte.NET/Forte.NET/Startup.cs:line 27
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.g__Startup|0(IServiceCollection serviceCollection)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.b__0(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.b__0(HostBuilderContext context, IServiceCollection services)
   at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at Forte.NET.Program.Main(String[] args) in /home/mark/media/Forte/Forte.NET/Forte.NET/Program.cs:line 7

The notable files are Startup.cs, Query.cs, and ForteDbContext.cs.

@tlil tlil added the bug label Jan 25, 2021
@tlil tlil self-assigned this Jan 25, 2021
@tlil tlil added enhancement and removed bug labels Jan 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants