GraphQL Query Returning Null Despite Correct Configuration #1200
Replies: 1 comment 1 reply
-
Hi! You are mixing things. The attributes you are using mappings:
auto_discover: false
types:
- type: attribute
dir: "%kernel.project_dir%/src/{GraphQL}"
suffix: ~ The directory you indicate in the yaml in the mapping is the folder where to look for the services marked with the attributes (it will autodetect the providers, the queries & mutations). The way you configured your service with The mapping Hope it helps! |
Beta Was this translation helpful? Give feedback.
-
I am facing an issue where a simple GraphQL query is returning null instead of the expected data. Here's a summary of my setup:
Resolver Class:
use Overblog\GraphQLBundle\Definition\Annotation as GQL;
GraphQL Schema (hello.graphql):
services.yaml:
yaml
services:
App\Resolver\HelloResolver:
tags:
- { name: 'overblog_graphql.resolver', method: 'hello' }
public: true
overblog_graphql.yaml:
GraphQL Query:
query {
hello {
message
}
}
Despite this setup, the query result is:
What I Have Tried:
Verified the resolver method is correctly defined and returning the expected array manually.
Checked that the resolver is correctly tagged in services.yaml.
Ensured the schema is correctly defined in the .graphql file.
Cleared Symfony cache multiple times.
Verified that the resolver service is loaded correctly using php bin/console debug:container | grep HelloResolver.
No errors or warnings in the logs.
Environment:
PHP version: 8.x
Symfony version: 7.2.x
Overblog/GraphQLBundle version: 1.7.0
Any assistance or guidance to resolve this issue would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions