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

Hm #22

Open
makebasic opened this issue Sep 21, 2020 · 7 comments
Open

Hm #22

makebasic opened this issue Sep 21, 2020 · 7 comments

Comments

@makebasic
Copy link

makebasic commented Sep 21, 2020

I made exactly the same stuff like your readme but get this error on: site/ npm run dev

"gatsby-wordpress-theme-phoenix" threw an error while running the createPages lifecycle:

Cannot read property 'HWGraphQL' of undefined

8 | // Create all pages.
9 | exports.createPages = async ( { actions, graphql } ) => {

10 | await createAllPages( { actions, graphql } );
| ^
11 | await createAllPosts( { actions, graphql } );
12 | await createFrontPage( { actions, graphql } );
13 | await createBlogPage( { actions, graphql } );

File: ../packages/gatsby-wordpress-theme-phoenix/gatsby-node.js:10:2

@puertasdigitales
Copy link

Same here.
Wordpress properly configured and frontend too, extrictly following instructions, but when running npm run dev this error appears:

ERROR #11321 PLUGIN
"gatsby-source-graphql" threw an error while running the sourceNodes lifecycle:
Unexpected token < in JSON at position 0

So it seems that frontend can't connect to backend...

@puertasdigitales
Copy link

Problem was the trailing slash ("/") at the end of the URL.

@RileySeaburg
Copy link

Problem was the trailing slash ("/") at the end of the URL.

Can you elaborate on this?
I tried writing my URL both ways and didn't see any result.

@fuhranku
Copy link

fuhranku commented Dec 4, 2020

Hey! I'm having the exact same issue after following all your instructions. When i run npm run dev i get the following error:

 ERROR #98123  WEBPACK

Generating development JavaScript bundle failed


C:\Users\frank\Desktop\gatsby-wp\packages\gatsby-wordpress-theme-phoenix\src\components\footer\index.js
  24:13  error  Cannot query field "HWGraphQL" on type "Query"  graphql/template-strings

✖ 1 problem (1 error, 0 warnings)


File: ..\packages\gatsby-wordpress-theme-phoenix\src\components\footer\index.js


 ERROR #98123  WEBPACK

Generating development JavaScript bundle failed


C:\Users\frank\Desktop\gatsby-wp\packages\gatsby-wordpress-theme-phoenix\src\components\header\index.js
  24:13  error  Cannot query field "HWGraphQL" on type "Query"  graphql/template-strings

✖ 1 problem (1 error, 0 warnings)


File: ..\packages\gatsby-wordpress-theme-phoenix\src\components\header\index.js

failed Building development bundle - 12.254s

@fuhranku
Copy link

fuhranku commented Dec 5, 2020

**Update for those who have encountered the same issue: ** I was trying to deploy this repo in a local enviroment. And the first error that gatsby was throwing was something about certificates issues that was preventing it from connecting to WP Graphql. So, after doing some research i found that if you put this flag in your .env you'll get around this error

NODE_TLS_REJECT_UNAUTHORIZED = 0

This is telling Gatsby to skip SSL certificates validation (Take care of your SSL if you are not in a local env instead of doing this).

Good luck!

@RileySeaburg
Copy link

Got this running Yesterday because of @fuhranku's advice.

@arckdash
Copy link

arckdash commented Feb 5, 2022

Sadly this did not fix my issue, I'm still getting the same error, the docs are out of date, and the plugins could use an update.

Tried to run this query on Wordpress > GraphiQL

query HeaderQuery {
				    HWGraphQL {
						header: getHeader {
						  siteLogoUrl
						  siteTagLine
						  siteTitle
						  favicon
						}
						headerMenuItems: menuItems(where: {location: HCMS_MENU_HEADER}) {
						  edges {
						    node {
						      id
						      menuItemId
						      label
						      url
						      childItems {
						        edges {
						          node {
						            menuItemId
						            label
						            url
						          }
						        }
						      }
						    }
						  }
						}
				    }
				}

but it says: HWGraphQL Cannot query field "HWGraphQL" on type "RootQuery\

I'm running WP from docker, the settings I have in gatsby-config.js are:

module.exports = {
  plugins: [
    // Tell gatsby which theme you will be using.
    {
      resolve: "gatsby-wordpress-theme-phoenix",
      options: {
        wordPressUrl: "http://localhost:8787",
        frontendUrl: "http://localhost:3009",
      },
    },
  ],
}

I access my WP instance by going to: http://localhost:8787

I've tried using the specific version of the plugins specified on the docs and also using their latest version, and I run into the same issue :/

 ERROR #11321  PLUGIN

"gatsby-source-graphql" threw an error while running the sourceNodes lifecycle:

Source GraphQL API: HTTP error 404 Not Found



  Error: Source GraphQL API: HTTP error 404 Not Found

...

ERROR #11321  PLUGIN

"gatsby-plugin-graphql-image" threw an error while running the createResolvers lifecycle:

SCHEMA 'hwgraphql NOT FOUND'

  23 |
  24 |   if (!schema){
> 25 |     throw new Error(`SCHEMA '${schemaName} NOT FOUND'`)
     |           ^
  26 |   } else{
  27 |     console.log(`Found schema '${schemaName}', traversing for fields with name '${imageUrlFieldName}'`)
  28 |   }

File: node_modules/gatsby-plugin-graphql-image/gatsby-node.js:25:11

...

"gatsby-wordpress-theme-phoenix" threw an error while running the createPages lifecycle:

Cannot read property 'HWGraphQL' of undefined

   8 | // Create all pages.
   9 | exports.createPages = async ( { actions, graphql } ) => {
> 10 | 	await createAllPages( { actions, graphql } );
     | 	^
  11 | 	await createAllPosts( { actions, graphql } );
  12 | 	await createFrontPage( { actions, graphql } );
  13 | 	await createBlogPage( { actions, graphql } );

File: node_modules/gatsby-wordpress-theme-phoenix/gatsby-node.js:10:2

...
failed createPages - 0.157s
success createPagesStatefully - 0.071s
info Total nodes: 74, SitePage nodes: 8 (use --verbose for breakdown)
success Checking for changed pages - 0.001s
success write out redirect data - 0.002s
success Build manifest and related icons - 0.088s
success onPostBootstrap - 0.092s
info bootstrap finished - 5.967s
success onPreExtractQueries - 0.001s

 ERROR #85923  GRAPHQL

There was an error in your GraphQL query:

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

...
failed extract queries from components - 2.187s
success write out requires - 0.007s
success run static queries - 0.052s - 6/6 115.74/s
success run page queries - 0.010s - 3/3 286.11/s
success Running gatsby-plugin-sharp.IMAGE_PROCESSING jobs - 0.054s - 2/2 37.10/s

Any help on this is highly appreciated :)

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

5 participants