Skip to content
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 "allWordPressPost" on type "Query". Did you mean "allGraphqlPost"? #12

Open
jhalmu opened this issue Apr 9, 2019 · 6 comments

Comments

@jhalmu
Copy link

jhalmu commented Apr 9, 2019

`Gridsome v0.5.7

Initialize - 0.13s
Request failed with status code 401: https://dividends-o-matic.net/cms/wp-json/wp/v2/feedback?per_page=100
Load sources - 2.94s
Create GraphQL schema - 0.1s
No content type was found for src/templates/WordPressPostTag.vue
No content type was found for src/templates/WordPressPost.vue
No content type was found for src/templates/WordPressCategory.vue
Set up routes - 0s
Generate code - 0.01s
Bootstrap finish - 3.19s

ERROR Failed to compile with 1 errors 18.37.49

error in ./src/pages/Index.vue?vue&type=custom&index=0&blockType=page-query

Module build failed (from ./node_modules/gridsome/lib/webpack/loaders/page-query.js):
Error: Cannot query field "allWordPressPost" on type "Query". Did you mean "allGraphqlPost"?

GraphQL request (15:3)
14: query Home ($page: Int) {
15: allWordPressPost (page: $page, perPage: 10) @paginate {
^
16: pageInfo {

at Object.module.exports (/Users/jhalmu/Documents/Production/gridsome-site/node_modules/gridsome/lib/webpack/loaders/page-query.js:33:21)

@ ./src/pages/Index.vue?vue&type=custom&index=0&blockType=page-query 1:0-312 1:328-331 1:333-642 1:333-642
@ ./src/pages/Index.vue
@ ./src/.temp/routes.js
@ ./node_modules/gridsome/app/router.js
@ ./node_modules/gridsome/app/app.js
@ ./node_modules/gridsome/app/entry.client.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client?name=app&reload=true ./node_modules/gridsome/app/entry.client.js

WAIT Compiling... 18.37.49

ERROR Failed to compile with 1 errors 18.37.49

error in ./src/pages/Index.vue?vue&type=custom&index=0&blockType=page-query

Module build failed (from ./node_modules/gridsome/lib/webpack/loaders/page-query.js):
Error: Cannot query field "allWordPressPost" on type "Query". Did you mean "allGraphqlPost"?

GraphQL request (15:3)
14: query Home ($page: Int) {
15: allWordPressPost (page: $page, perPage: 10) @paginate {
^
16: pageInfo {

at Object.module.exports (/Users/jhalmu/Documents/Production/gridsome-site/node_modules/gridsome/lib/webpack/loaders/page-query.js:33:21)

@ ./src/pages/Index.vue?vue&type=custom&index=0&blockType=page-query 1:0-312 1:328-331 1:333-642 1:333-642
@ ./src/pages/Index.vue
@ ./src/.temp/routes.js
@ ./node_modules/gridsome/app/router.js
@ ./node_modules/gridsome/app/app.js
@ ./node_modules/gridsome/app/entry.client.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client?name=app&reload=true ./node_modules/gridsome/app/entry.client.js

@hjvedvik
Copy link
Member

hjvedvik commented Apr 9, 2019

What does the @gridsome/source-wordpress options in your gridsome.config.js look like?

@jhalmu
Copy link
Author

jhalmu commented Apr 9, 2019

module.exports = {
siteName: 'Gridsome',
siteDescription: 'A WordPress starter for Gridsome',
plugins: [
{
use: '@gridsome/source-wordpress',
options: {
baseUrl: 'https://eetti.fi/', // required
typeName: 'Wordpress', // GraphQL schema name (Optional)
perPage: 100, // How many posts to load from server per request (Optional)
concurrent: 10, // How many requests to run simultaneously (Optional)
routes: {
post: '/:year/:month/:day/:slug', //adds route for "post" post type (Optional)
post_tag: '/tag/:slug' // adds route for "post_tag" post type (Optional)
}
}
}
]
}

Tried several with differed Wp-pages.

@hjvedvik
Copy link
Member

hjvedvik commented Apr 9, 2019

The typeName option must match the names you use in the queries and template names. Should work better if you change it to WordPress (uppercase P). Or just remove the option, as the default value is also WordPress.

@jhalmu
Copy link
Author

jhalmu commented Apr 9, 2019

Ha, thanks. I tried first remove the word WordPress, but it crashes of course. Removing that helps. So this works.

Should there be action when you press Read more or is that action for enduser to do?

@jhalmu
Copy link
Author

jhalmu commented Apr 9, 2019

Updated source plugin and now Read me -link works.
Before working have to do featuredMedia fix like in issue #10 to WordPressPost.vue

featuredMedia { sourceUrl altText mediaDetails { width } }

@myerzman
Copy link

Yeah I had the same issue and I updated both my ACF to REST API plugin and ACF plugin on the wordpress side, and everything worked again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants