Gatsby-WordPress icon indicating copy to clipboard operation
Gatsby-WordPress copied to clipboard

TypeError: Cannot read property 'allWordpressPage' of undefined

Open Adrian-Swifter opened this issue 6 years ago • 6 comments

I followed your tutorial and i cant get past this graphql error? Even when i clone your repo, results are same...

Adrian-Swifter avatar Jun 11 '18 11:06 Adrian-Swifter

Do you have Wordpress installed? Does it have REST API enabled. This looks to me like Gatsby is not connecting your Wordpress, you need to double check that.

ivandoric avatar Jun 11 '18 11:06 ivandoric

I have installed wordpress on my local machine and gatsby folder inside worpresss installation...everything worked normally, but when i added gatsby-node.js, page.js and post.js, this error started showing up

Adrian-Swifter avatar Jun 11 '18 12:06 Adrian-Swifter

Hmmm, can you try and pin point the file that is causing problems and then paste the code here so I can take a look see. Or maybe just paste all three files if you can't pin point the one that is causing problems.

ivandoric avatar Jun 14 '18 07:06 ivandoric

Hello. Same problem here.

error gatsby-node.js returned an error
  TypeError: Cannot read property 'allWordpressPage' of undefined

I reinstalled WordPress on my local machine (using proxy),but still not working and receiving this type of error. Here is my gatsby-config.js:

module.exports = {
    siteMetadata: {
        title: 'Wordpress Gatsby',
        subtitle: `Fetch Data From Local WP Install`,
    },
    plugins: [
        'gatsby-plugin-react-helmet',
        {
            resolve: "gatsby-source-wordpress",
            options: {
                baseUrl: "dollyswp.test",
                protocol: "http",
                hostingWPCOM: false,
                useACF: true,
                verboseOutput: true
            }
        },
        'gatsby-transformer-sharp',
        'gatsby-plugin-sharp'
    ],
};

Everything works fine in command line - mean, that fetching from url works well

dolnma avatar Sep 15 '18 10:09 dolnma

I'm running into this issue right now as well, and it looks like the reason I can't connect is because axios throws an error about a self-signed certificate on my localhost. changing to my local vhost and baseURL to http solved my issue.

8bit-echo avatar Dec 23 '18 07:12 8bit-echo

I had the same issue, the reason was that in plugins -> options -> It was: baseUrl: "webpagename", instead of baseUrl: "webpagename.local" (or what domain you're using)

DanielBarbakadze avatar Jan 26 '21 17:01 DanielBarbakadze