-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error Cannot query field "siteSearchIndex" on type "Query" graphql/template-strings #26
Comments
Hey! I never messed around with gatsby and wordpress. I did some work with strapi though and I came across the same problem as you. Even though the names of the queries are wordpress__PAGE, wordpress__POST, I learnt that node types usual start with a Capital Letter e.g Wordpress__PAGE. Try to write the type of the node in the Resolvers object and not the name. |
@vabelha Thanks for the reply and I really appreciate the help. Unfortunately, I tried updating the spelling of the resolvers, but I'm still getting the same error. |
@TJBriggs were you able to resolve this issue?
UPDATE |
I had a similar issue on a Gatsby project. I was getting an error that said "cannot query field on template strings." To isolate the problem I ran the same query in the GraphQL IDE and found no error. Then I saw a thread on Github where someone suggested restarting the server. So I did that and it worked. I forgot every time you make changes to the gatsby-config.js file you have to restart the server for it to take effect. So until I did that it was throwing errors when it went to look for data I was querying that hadn't yet been updated. Hope that's helpful to folks that run into the same problem! |
Hello. I restarted the server. It worked. |
I've searched through all the related issues and tried everything I could find, but I'm still getting the following error when I try to save my header component with the Search component included:
error Cannot query field "siteSearchIndex" on type "Query" graphql/template-strings
I'm fairly new to Gatsby so I may have overlooked something. Any help would be greatly appreciated.
Here are the relevant site files:
package.json:
gatsby-config.js:
search.js:
header.js:
When following the examples on Github I didn't see any code changes to gatsby-node.js. Was I supposed to update this file to make the search work? Here is my current gatsby-node.js file just in case this may be causing issues:
The text was updated successfully, but these errors were encountered: