craftcms / gatsby-source-craft

Gatsby source plugin for Craft CMS.
MIT License
54 stars 13 forks source link

Sourcing data error #38

Closed Matthaios closed 3 years ago

Matthaios commented 3 years ago

Description

I get errors when trying to local develop and I don't get any nodes back. All fields are checked in Craft so that shouldn't be the problem that the nodes are not getting back.

Steps to reproduce

  1. gatsby develop

Additional info

 ERROR #11321  PLUGIN

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

Failed to execute query LIST_Homepage_Homepage_Entry.
Errors:
No GraphQL query was supplied

  468 |     if (remoteConfigVersion !== localConfigVersion || !localContentUpdateTime) {
  469 |         reporter.info("Cached content is unavailable or outdated, sourcing _all_ nodes.");
> 470 |         await sourceAllNodes(config);
      |         ^
  471 |     }
  472 |     else {
  473 |         reporter.info(`Craft config version has not changed since last sourcing. Checking for content       
changes since "${localContentUpdateTime}".`);

File: node_modules\gatsby-source-craft\gatsby-node.js:470:9

  Error: Failed to execute query LIST_Homepage_Homepage_Entry.
  Errors:
  No GraphQL query was supplied

  - paginate.ts:60 Object.paginate
    [emson-brands-shopify]/[gatsby-source-craft]/[gatsby-graphql-source-toolkit]/src/source-nodes/fetch-nodes/pagina    te.ts:60:13

  - task_queues.js:97 processTicksAndRejections
    internal/process/task_queues.js:97:5

  - fetch-lists.ts:61 fetchNodeList
    [emson-brands-shopify]/[gatsby-source-craft]/[gatsby-graphql-source-toolkit]/src/source-nodes/fetch-nodes/fetch-    lists.ts:61:20

  - fetch-lists.ts:36 Object.fetchAllNodes
    [emson-brands-shopify]/[gatsby-source-craft]/[gatsby-graphql-source-toolkit]/src/source-nodes/fetch-nodes/fetch-    lists.ts:36:24

  - create-nodes.ts:13 Object.createNodes
    [emson-brands-shopify]/[gatsby-source-craft]/[gatsby-graphql-source-toolkit]/src/source-nodes/node-actions/creat    e-nodes.ts:13:20

  - async Promise.all

  - source-all-nodes.ts:20 sourceAllNodes
    [emson-brands-shopify]/[gatsby-source-craft]/[gatsby-graphql-source-toolkit]/src/source-nodes/source-all-nodes.t    s:20:3

  - gatsby-node.js:470 Object.exports.sourceNodes
    [emson-brands-shopify]/[gatsby-source-craft]/gatsby-node.js:470:9

  - api-runner-node.js:434 runAPI
    [emson-brands-shopify]/[gatsby]/src/utils/api-runner-node.js:434:16
Matthaios commented 3 years ago

This is the query file from craft-debug but couldn't upload it so I just added .md extension to be able to upload it here.

Homepage_Homepage_Entry.md

andris-sevcenko commented 3 years ago

Appreciate it! Can you copy/paste all that into the Craft's GraphiQL IDE and execute the LIST query? What are the results?

andris-sevcenko commented 3 years ago

Ideally, please select the same schema in the IDE that you're using for Gatsby.

Matthaios commented 3 years ago

I get this:

{
  "errors": [
    {
      "message": "No GraphQL query was supplied"
    }
  ]
}
andris-sevcenko commented 3 years ago

Huh. That one is thrown by Craft if there is no query provided. This sounds like an environmental issue with POST being redacted or something? What's your hosting environment?

Matthaios commented 3 years ago

Hm... I'm the frontend dev on the project. Will wait for the backend dev if he can provide details.

we-do commented 3 years ago

The problem seems to have been with the Apache server configuration and us exceeding the post request size config.

Hope this helps anyone else! :)

szymonStawowy94 commented 3 years ago

I have the same problem with running gatsby develop. I've got the newest version of Craft (3.6.16), PHP version on server - 7.3.23, gatsby-source-craft plugin version - 2.0.2. Errors which occur:

ERROR #85901 GRAPHQL There was an error in your GraphQL query: Unknown type Craft_... (the same error for every single node)

ERROR #85923 GRAPHQL There was an error in your GraphQL query: Cannot query field "allCraftCookiesGlobalSet" on type "Query".

It seems that gatsby develop command finishes but I get page without data from CMS and there are no nodes with data. Any ideas?

andris-sevcenko commented 3 years ago

@szymonStawowy94 so many questions.

andris-sevcenko commented 3 years ago

Closing this as the original issue has been solved.