directus / gatsby-source-directus

Source plugin for pulling data into Gatsby from a Directus API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot query field "directus" on type "Query"

treboryx opened this issue · comments

Untouched example from
https://github.com/directus/examples (both the directus setup & gatsby starter)

Running it and visiting the index page produces the following error

success onPreExtractQueries - 0.001s                                                                                                                                                                                                                                                                                  

 ERROR #85923  GRAPHQL

There was an error in your GraphQL query:

Cannot query field "directus" on type "Query".

If you don't expect "directus" to exist on the type "Query" it is most likely a typo. However, if you expect "directus" to exist there are a couple of solutions to common problems:

- If you added a new data source and/or changed something inside gatsby-node/gatsby-config, please try a restart of your development server.
- You want to optionally use your field "directus" and right now it is not used anywhere.

It is recommended to explicitly type your GraphQL schema if you want to use optional fields.

File: src\pages\index.jsx:41:5

See our docs page for more info on this error: https://gatsby.dev/creating-type-definitions

failed extract queries from components - 0.249s 

This should be fixed on latest release (#17), the example has been updated to use it as well.

This should be fixed on latest release, the example has been updated to use it as well.

I've just tried that and still getting the error

 ERROR #85923  GRAPHQL.VALIDATION

There was an error in your GraphQL query:

Cannot query field "directus" on type "Query".

If you don't expect "directus" to exist on the type "Query" it is most likely a typo. However, if you expect "directus" to exist there are a couple of solutions to common problems:

- If you added a new data source and/or changed something inside gatsby-node/gatsby-config, please try a restart of your development server.
- You want to optionally use your field "directus" and right now it is not used anywhere.

It is recommended to explicitly type your GraphQL schema if you want to use optional fields.

File: src\pages\index.jsx:41:5

See our docs page for more info on this error: https://gatsby.dev/creating-type-definitions

Using node 18.

I also updated directus to the latest version.