Im trying to setup a headless WP project using faustjs, WPgraphQL and ACF. Later im planning to also implement Shopify shopfront API. I was setting up the project, installing all the plugins and setting them up. So i have setup my .env.local and i have setup the faust settings in the WP admin panel.
After adding some custom fields and adding content that i could fetch, i tried to generate a post types object using "npm run generate", but after running the command i get this error.
error - Unable to find a GraphQL endpoint at http://localhost:10039/index.php?graphql error - WPGraphQL may not be active, or your WordPress site is unavailable.
I have looked this error up but i can't find a solution for it.
I tried different ways in starting such project as described above. First i tried to use the Atlas: Headless WP plugin and using a Shopify Blueprint. Everything went well until i tried to run "npm run dev". After that i got the same error.
I also tried a tutorial. I used all the code supplied in the video, but when i tried opening the site that was running localy, i got an Apollo error: failed to fetch.
After troubleshooting for some time nothing worked, so i decided to try a different tutorial (Current project) and that's where i ran into the problem with the "npm run generate" command.
I encountered a similar issue in my local dev environment. Upon searching the project, I located the line of code generating the error message. I observed that this line is within a try/catch block, and there is an 'err' variable that could potentially provide more detailed information about why the error.
To summarize, there were indeed additional details. In my specific situation, I was utilizing HTTPS with self-signed certificates, and 'node-fetch' was producing an error due to the certificates not being validated. I fixed it by adding NODE_TLS_REJECT_UNAUTHORIZED=0 to the .env file.