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

Exception when enabling Lucene/Elasticsearch modules without enabling Queries module in GraphQL #14999

Closed
mdameer opened this issue Jan 5, 2024 · 4 comments · Fixed by #15015
Labels
Milestone

Comments

@mdameer
Copy link
Contributor

mdameer commented Jan 5, 2024

When trying to enable "Lucene" or "Elasticsearch" modules without enabling "Queries" module, then navigate to GraphiQL page it will return (500 Internal Server Error) with the following exception, due to trying resolve "IQueryManager" by "LuceneQueryFieldTypeProvider" and "ElasticQueryFieldTypeProvider":

System.NullReferenceException: Object reference not set to an instance of an object.
at OrchardCore.Queries.Lucene.GraphQL.Queries.LuceneQueryFieldTypeProvider.GetIdentifierAsync() in /Users/mdameer/Downloads/OrchardCore-main/src/OrchardCore.Modules/OrchardCore.Search.Lucene/GraphQL/LuceneQueryFieldTypeProvider.cs:line 33
at OrchardCore.Apis.GraphQL.Services.SchemaService.GetSchemaAsync() in /Users/mdameer/Downloads/OrchardCore-main/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Services/SchemaService.cs:line 87
at OrchardCore.Apis.GraphQL.GraphQLMiddleware.ExecuteAsync(HttpContext context, ISchemaFactory schemaService, IDocumentWriter documentWriter) in /Users/mdameer/Downloads/OrchardCore-main/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/GraphQLMiddleware.cs:line 141
at OrchardCore.Apis.GraphQL.GraphQLMiddleware.Invoke(HttpContext context, IAuthorizationService authorizationService, IAuthenticationService authenticationService, ISchemaFactory schemaService, IDocumentWriter documentWriter) in /Users/mdameer/Downloads/OrchardCore-main/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/GraphQLMiddleware.cs:line 64

I think that we need to add "OrchardCore. Queries" as a required feature for GraphQL startup in both modules, or create new features for GraphQL in both modules and set "OrchardCore. Queries" as a dependency, what do you think?

@hishamco
Copy link
Member

hishamco commented Jan 7, 2024

    [RequireFeatures("OrchardCore.Apis.GraphQL")]
    public class Startup : StartupBase
    {
        public override void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton<ISchemaBuilder, LuceneQueryFieldTypeProvider>();
        }
    }

I'm not sure how the GraphiQL page shows up without enable GraphQL feature?

@MikeAlhayek
Copy link
Member

I think that we need to add "OrchardCore.Queries" as a required feature for GraphQL startup in both modules

@mdameer I agree with that statement.

@hishamco
Copy link
Member

hishamco commented Jan 9, 2024

I thought @mdameer will start his first PR :)

@mdameer
Copy link
Contributor Author

mdameer commented Jan 9, 2024

@hishamco it would have been a nice kick-off ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants