- Issue created by @whiz11
When running a simple graphql query on File entities, it results in an error. Below is the graphql query followed by the error
query MyQuery {
entityById(entityType: FILE, id: "1") {
label
id
}
}
ArgumentCountError: file() expects at least 1 argument, 0 given in file() (line 406 of /app/vendor/webonyx/graphql-php/src/Type/Schema.php)
#0 /app/vendor/webonyx/graphql-php/src/Type/Schema.php(406): file()
#1 /app/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(946): GraphQL\Type\Schema::resolveType('File')
#2 /app/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(789): GraphQL\Executor\ReferenceExecutor->completeAbstractValue(Object(GraphQL\Type\Definition\InterfaceType), Object(ArrayObject), Object(GraphQL\Type\Definition\ResolveInfo), Array, Object(Drupal\file\Entity\File))
#3 /app/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(651): GraphQL\Executor\ReferenceExecutor->completeValue(Object(GraphQL\Type\Definition\InterfaceType), Object(ArrayObject), Object(GraphQL\Type\Definition\ResolveInfo), Array, Object(Drupal\file\Entity\File))
#4 /app/vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromise.php(148): GraphQL\Executor\ReferenceExecutor->GraphQL\Executor\{closure}(Object(Drupal\file\Entity\File))
#5 /app/vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromise.php(53): GraphQL\Executor\Promise\Adapter\SyncPromise->GraphQL\Executor\Promise\Adapter\{closure}()
I also tried with referenced entities and I get the same above error.
query MyQuery {
entityQuery(entityType: NODE) {
items {
... on NodeArticle {
id
title
referencedEntities {
id
}
}
}
}
}
- On a fresh Drupal 9 install, add an image field (Image) to the Article content type
- Enable the following extensions in the Core Schema Server
- Entity Query Extension
- Image
- Reverse Entity Reference
- Enable the following entity types, file, node and node_type
- Run the above provided graphql queries
- Notice the error in the error logs
Active
1.0
Code