drupal-graphql / graphql

GraphQL integration for Drupal 9/10
288 stars 202 forks source link

Explorer is broken [ Drupal 8.6.x ] #465

Closed martinfrances107 closed 6 years ago

martinfrances107 commented 6 years ago

Steps to reproduce

[on Drupal 8.6.x ]

visit /graphql/explorer ( see error below ) ... I am looking at this now.

TypeError: Argument 8 passed to Drupal\graphql_core\Plugin\GraphQL\Fields\Blocks\BlocksByRegion::__construct() must be an instance of Drupal\Core\Entity\EntityTypeManager, instance of Drupal\webprofiler\Entity\EntityManagerWrapper given, called in /xxx//drupal/modules/graphql/modules/graphql_core/src/Plugin/GraphQL/Fields/Blocks/BlocksByRegion.php on line 75

martinfrances107 commented 6 years ago

I have created a two line PR which fixes the problem

captaindav commented 6 years ago

I am getting a different error at /graphql/explorer (see below). I am running on Drupal 8.4.3. Is it a typo that this issue has "Drupal 8.6.x" in the title, shouldn't it be "Drupal 8.5.x"? Is there a need for me to upgrade my site's Core version to the 8.5.x development branch in order to use the GraphQL module?

/graphql/explorer Error:

`The website encountered an unexpected error. Please try again later.

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 133 of core/lib/Drupal/Core/Entity/EntityTypeManager.php).

Drupal\graphql_core\TypeMapper->typedDataToGraphQLFieldType(Object) (Line: 36)
Drupal\graphql_core\Plugin\Deriver\Fields\EntityFieldItemDeriver->getDerivativeDefinitionsFromFieldDefinition('outline_entry', Object, Array) (Line: 106)
Drupal\graphql_core\Plugin\Deriver\EntityFieldDeriverBase->getDerivativeDefinitions(Array) (Line: 101)
Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives(Array) (Line: 87)
Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions() (Line: 283)
Drupal\Core\Plugin\DefaultPluginManager->findDefinitions() (Line: 174)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 81)
Drupal\graphql\Plugin\GraphQL\PluggableSchemaBuilder->find(Object, Array) (Line: 121)
Drupal\graphql\Plugin\GraphQL\Schemas\SchemaPluginBase->getRootFields() (Line: 72)
Drupal\graphql\Plugin\GraphQL\Schemas\SchemaPluginBase->getSchema() (Line: 139)
Drupal\graphql\GraphQL\Schema\SchemaLoader->getSchema('default') (Line: 86)
Drupal\graphql\GraphQL\Execution\QueryProcessor->processQuery('default', '    query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
name
description
locations
args {
...InputValue
}
}
}
}

fragment FullType on __Type {
  kind
  name
  description
  fields(includeDeprecated: true) {
    name
    description
    args {
      ...InputValue
    }
    type {
      ...TypeRef
    }
    isDeprecated
    deprecationReason
  }
  inputFields {
    ...InputValue
  }
  interfaces {
    ...TypeRef
  }
  enumValues(includeDeprecated: true) {
    name
    description
    isDeprecated
    deprecationReason
  }
  possibleTypes {
    ...TypeRef
  }
}

fragment InputValue on __InputValue {
  name
  description
  type { ...TypeRef }
  defaultValue
}

fragment TypeRef on __Type {
  kind
  name
  ofType {
    kind
    name
    ofType {
      kind
      name
      ofType {
        kind
        name
        ofType {
          kind
          name
          ofType {
            kind
            name
            ofType {
              kind
              name
              ofType {
                kind
                name
              }
            }
          }
        }
      }
    }
  }
}') (Line: 131)

Drupal\graphql\GraphQL\Utility\Introspection->introspect('default') (Line: 77) Drupal\graphql\Controller\ExplorerController->viewExplorer('default') call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 576) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() call_user_func_array(Object, Array) (Line: 153) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67) Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 57) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 38) Drupal\jsonapi\StackMiddleware\FormatSetter->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 657) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

`

fubhy commented 6 years ago

@captaindav Hi there. Can you upgrade the graphql module to the latest 8.x-3.x-dev version and try again? I just merged the fix from @martinfrances107 which seems unrelated to your issue but who knows. If this doesn't work, please open a new issue. One more hint from reading your stack trace: It seems that your entity type "outline_entry" is malformed. Can you set a xdebug breakpoint in there to figure out what's going on with the property mapping in the TypeMapper service?

captaindav commented 6 years ago

@fubhy, Thanks for your quick response.

Uninstalling the outline module and updating graphql to the latest dev version fixed the error I originally reported, the /graphql/explorer page works. Re-enabling the outline module gives the error again, so I guess that is due to the malformed outline_entry entity. Have you any idea what might be wrong with the outline_entry entity to cause the malformed entity exception?

I get an error at /graphql/voyager: (pops up in red and can be cleared):

abort(7) at Error at Ga (blob:http://agency.local/e55183a2-1399-46cf-9bc9-6388fa76dda9:420:124) at Fa (blob:http://agency.local/e55183a2-1399-46cf-9bc9-6388fa76dda9:420:22) at v (blob:http://agency.local/e55183a2-1399-46cf-9bc9-6388fa76dda9:1554:101) at Array.hR (blob:http://agency.local/e55183a2-1399-46cf-9bc9-6388fa76dda9:1539:32781) at fv (blob:http://agency.local/e55183a2-1399-46cf-9bc9-6388fa76dda9:1533:28979) at $v (blob:http://agency.local/e55183a2-1399-46cf-9bc9-6388fa76dda9:1533:57063) at aw (blob:http://agency.local/e55183a2-1399-46cf-9bc9-6388fa76dda9:1533:61059) at bw (blob:http://agency.local/e55183a2-1399-46cf-9bc9-6388fa76dda9:1533:61151) at Xt (blob:http://agency.local/e55183a2-1399-46cf-9bc9-6388fa76dda9:1533:11673) at jc (blob:http://agency.local/e55183a2-1399-46cf-9bc9-6388fa76dda9:1528:753) If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.

captaindav commented 6 years ago

See related issue #474