craftcms / gatsby-source-craft

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

Error while sourcing with "Allow listing non-live and otherwise inactive elements." disabled in Schema #61

Closed andreasottosson closed 2 years ago

andreasottosson commented 2 years ago

Description

Guess who's back.. na na na.. back again ;)

Gatsby build fails when this is unchecked,

 ERROR #11321  PLUGIN

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

Failed to execute query LIST_forhandlere_forhandler_Entry.
Errors:
Unknown argument "status" on field "entry" of type "Query".

  510 |     if (remoteConfigVersion !== localConfigVersion || !localContentUpdateTime) {
  511 |         reporter.info("Cached content is unavailable or outdated, sourcing _all_ nodes.");
> 512 |         await sourceAllNodes(config);
      |         ^
  513 |     }
  514 |     else {
  515 |         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:512:9

From Craft's web.log:

2021-12-02 11:40:33 [-][-][-][error][GraphQL\Error\Error] Unknown argument "status" on field "entry" of type "Query".

GraphQL (2:35)
1: query NODE_produkter_glasdore_Entry($id: [QueryArgument], $siteId: [QueryArgument]) {
2:   entry(id: $id, siteId: $siteId, status: null) {
                                     ^
3:     remoteTypeName: __typename

Steps to reproduce

  1. Uncheck "Allow listing non-live and otherwise inactive elements." in your Craft GQL schema settings
  2. Source data
  3. Pull your hair out ;)

Additional info

andris-sevcenko commented 2 years ago

That is the expected behavior, as Live Preview on a Gatsby site will fail otherwise. Also, there's a search option for the repository :)