TylerBarnes / using-gatsby-source-wordpress-experimental

A starter for the upcoming gatsby-source-wordpress@v4
https://www.npmjs.com/package/gatsby-source-wordpress-experimental
MIT License
86 stars 29 forks source link

VAlidationError when fetching post #24

Open abshkd opened 3 years ago

abshkd commented 3 years ago
Failed to validate error Error [ValidationError]: "config" is not allowed. "request" is not allowed. "response" is not allowed. "isAxiosError" is not allowed. "toJSON" is not allowed
    at Object.exports.process (E:\github\wordpress-export\creu\wordpress-gatsby\node_modules\@hapi\joi\lib\errors.js:202:19)
    at internals.Object._validateWithOptions (E:\github\wordpress-export\creu\wordpress-gatsby\node_modules\@hapi\joi\lib\types\any\index.js:763:31)
    at internals.Object.validate (E:\github\wordpress-export\creu\wordpress-gatsby\node_modules\@hapi\joi\lib\types\any\index.js:797:21)
    at constructError (E:\github\wordpress-export\creu\wordpress-gatsby\node_modules\gatsby\node_modules\gatsby-cli\lib\structured-errors\construct-error.js:52:32)
    at Reporter.error (E:\github\wordpress-export\creu\wordpress-gatsby\node_modules\gatsby\node_modules\gatsby-cli\lib\reporter\reporter.js:135:59)
    at Object.error (E:\github\wordpress-export\creu\wordpress-gatsby\node_modules\gatsby\src\utils\api-runner-node.js:190:16)
    at handleFetchErrors (E:\github\wordpress-export\creu\wordpress-gatsby\node_modules\gatsby-source-wordpress-experimental\src\utils\fetch-graphql.js:242:14)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at fetchGraphql (E:\github\wordpress-export\creu\wordpress-gatsby\node_modules\gatsby-source-wordpress-experimental\src\utils\fetch-graphql.js:544:5)
    at paginatedWpNodeFetch (E:\github\wordpress-export\creu\wordpress-gatsby\node_modules\gatsby-source-wordpress-experimental\src\steps\source-nodes\fetch-nodes\fetch-nodes-paginated.js:59:20)
    at fetchWPGQLContentNodes (E:\github\wordpress-export\creu\wordpress-gatsby\node_modules\gatsby-source-wordpress-experimental\src\steps\source-nodes\fetch-nodes\fetch-nodes.js:44:26)
    at E:\github\wordpress-export\creu\wordpress-gatsby\node_modules\gatsby-source-wordpress-experimental\src\steps\source-nodes\fetch-nodes\fetch-nodes.js:149:30
    at E:\github\wordpress-export\creu\wordpress-gatsby\node_modules\gatsby-source-wordpress-experimental\src\steps\source-nodes\fetch-nodes\fetch-nodes.js:139:9
    at async Promise.all (index 0)
    at runFnForEachNodeQuery (E:\github\wordpress-export\creu\wordpress-gatsby\node_modules\gatsby-source-wordpress-experimental\src\steps\source-nodes\fetch-nodes\fetch-nodes.js:127:5) {
  isJoi: true,
  details: [
    {
      message: '"config" is not allowed',
      path: [Array],
      type: 'object.allowUnknown',
      context: [Object]
    },
    {
      message: '"request" is not allowed',
      path: [Array],
      type: 'object.allowUnknown',
      context: [Object]
    },
    {
      message: '"response" is not allowed',
      path: [Array],
      type: 'object.allowUnknown',
      context: [Object]
    },
    {
      message: '"isAxiosError" is not allowed',
      path: [Array],
      type: 'object.allowUnknown',
      context: [Object]
    },
    {
      message: '"toJSON" is not allowed',
      path: [Array],
      type: 'object.allowUnknown',
      context: [Object]
    }
  ],
  _object: {
    context: {},
    config: {
      url: 'http://localhost/graphql',
      method: 'post',
      data: '{"query":" query NODE_LIST_QUERY($first:Int!,$after:String,){categories(first:$first,after:$after,){nodes{ancestors(first:100){nodes{id}}wpChildren:children(first:100){nodes{id}}contentNodes(first:100){nodes{id __typename}}count databaseId description id link name wpParent:parent{node{id}}parentDatabaseId parentId posts(first:100){nodes{id}}slug taxonomy{node{id}}termGroupId termTaxonomyId uri __typename}pageInfo{hasNextPage endCursor}}}","variables":{"first":100,"url":"http://localhost/graphql","after":null}}',
      headers: [Object],
      transformRequest: [Array],
      transformResponse: [Array],
      timeout: 30000,
      adapter: [Function: httpAdapter],
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      validateStatus: [Function: validateStatus]
    },
    code: 'ECONNABORTED',
    request: Writable {
      _writableState: [WritableState],
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      _options: [Object],
      _redirectCount: 0,
      _redirects: [],
      _requestBodyLength: 515,
      _requestBodyBuffers: [Array],
      _onNativeResponse: [Function (anonymous)],
      _currentRequest: [ClientRequest],
      _currentUrl: 'http://localhost/graphql',
      [Symbol(kCapture)]: false
    },
    response: undefined,
    isAxiosError: true,
    toJSON: [Function (anonymous)],
    pluginName: 'gatsby-source-wordpress-experimental',
    text: 'There was an error',
    level: 'ERROR',
    stack: [],
    docsUrl: 'https://gatsby.dev/issue-how-to'
  },
  annotate: [Function (anonymous)]
}

package.json

"dependencies": {
    "@chakra-ui/core": "^0.8.0",
    "@emotion/core": "^10.0.35",
    "@emotion/styled": "^10.0.27",
    "add": "^2.0.6",
    "dotenv": "^8.2.0",
    "emotion-theming": "^10.0.27",
    "gatsby": "^2.24.37",
    "gatsby-image": "^2.4.20",
    "gatsby-plugin-chakra-ui": "^0.1.4",
    "gatsby-plugin-netlify-cache": "^1.2.0",
    "gatsby-plugin-react-svg": "^3.0.0",
    "gatsby-plugin-sharp": "^2.6.38",
    "gatsby-source-filesystem": "^2.3.32",
    "gatsby-source-wordpress-experimental": "^2.3.1",
    "gatsby-transformer-sharp": "2.5.16",
    "gatsby-wordpress-experimental-inline-images": "^0.0.3",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-paginate": "^6.5.0",
    "yarn": "^1.22.10"
  },

wordpress is latest version 5.5.3. I have over 500 posts but there is no server error. the query run fine in graphiql ide

TylerBarnes commented 3 years ago

Hi @abshkd, can you share a reproduction repo and /graphql url I can use to debug?

Thanks

abshkd commented 3 years ago

@TylerBarnes my repo was actually just a clone a of yours with config edits. The reason I posted my package.json as those were the updates I had to apply for some other errors due to wpgraphql being updated. I can share the repo but I my /graphql was locally hosted with docker. I dont have an online one. I will need to set it up for you. Give me sometime to figure that out.

TylerBarnes commented 3 years ago

Ahh, got it. No worries. For what it's worth I'm archiving this repo today and replacing it with an official Gatsby starter. That starter will be up to date with the latest changes in the source plugin 👍 This one is not currently up to date which can be frustrating

abshkd commented 3 years ago

yay, Then I might as well wait for that and try it again. I endured a whole day of frustration because I would do anything to get rid of my 20+ wordpress sites 👍 I already replaced my old blog but with mdx. Larger ones are still going to be headless.

I am ready to clone that and give it a try asap. thank you for the great work so far.

TylerBarnes commented 3 years ago

Ahh, sorry about that! That sounds painful. We'll get you sorted out here soon! I'll post a link here with the new starter once it's up

TylerBarnes commented 3 years ago

This is it https://github.com/gatsbyjs/gatsby-starter-wordpress-blog

It's brand new so it may have some issues here and there but it's up to date with the latest versions and works 👍

abshkd commented 3 years ago

Your updates give me ADD :D I am on it now