Uploaded image for project: 'Magnolia GraphQL'
  1. Magnolia GraphQL
  2. MGNLGQL-179

Error 500 when disabling content type

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 1.1.6
    • 1.1.5

      Steps to reproduce

      1. Create decoration file as follows:
        <light-module>/decorations/graphql-core/graphqlTypes/asset.yaml
        enabled=false
        
      2. Restart the instance
      3. Launch graphQL app

      Expected results

      App opens correctly

      Actual results

      An error occurs:

      {
        "status": 500,
        "errors": [
          "An internal server occurred, please check the log file"
        ]
      }
      

      Logs show the following error:

      ERROR info.magnolia.graphql.core.http.GraphQLServlet    : Failed to execute the GraphQL query
      graphql.AssertException: type Asset not found in schema
      

      Workaround

      Override GraphQLSchemaBuilder to filter disabled types

      public class GraphQLSchemaBuilder {
                   .filter(DefinitionProvider::isValid)
                   .filter(provider -> provider.getProblems().stream().noneMatch(problem -> problem.getSeverityType() == DefinitionProvider.Problem.SeverityType.SEVERE))
                   .map(DefinitionProvider::get)
      +            // PATCHED CHANGE: Filter disabled definitions
      +            .filter(GraphQLDefinition::isEnabled)
                   .collect(Collectors.toList());
               for (final GraphQLDefinition graphQLDefinition : graphQLDefinitions) {
                   graphQLDefinition.getTypes()
      

      Development notes

        Acceptance criteria

              jsimak Jaroslav Simak
              jayala Jonathan Ayala
              DeveloperX
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Work Started: