gridsome / gridsome-starter-wordpress

👩‍💻 WordPress starter for Gridsome
https://gridsome-starter-wordpress.netlify.app/
91 stars 31 forks source link

Error: Cannot query field "allWordPressPost" on type "Query". Did you mean "allGraphqlPost"? #12

Open jhalmu opened 5 years ago

jhalmu commented 5 years ago

`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 commented 5 years ago

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

jhalmu commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 4 years ago

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.