Hi There! My server is throwing an Error: Query.Track defined in resolvers, but not in schema
But when i look thru the schema i can clearly see the Track being defined under tracksForHome: [Track!]!
. Is there any way you can help or suggestions on this?
Hey @Luganda! Thanks for the info, hope we can troubleshoot this together
The error refers to Query.Track
, which makes me think your resolvers are structured like this:
const resolvers = {
Query: {
Track: {
// resolver code for Track fields
}
}
This doesn’t follow the structure of the schema. Track
should not be nested inside Query
, instead it should be in the same level. Like this:
const resolvers = {
Query: {
tracksForHome: () => { // resolver code }
}
Track: {
// resolver code for Track fields
}
Can you try that? You can also paste your resolvers file here so we can take a closer look!
1 Like
Thanks Michelle! This worked
Glad to hear it! Reach out if you get stuck on anything else!
1 Like