pristas-peter / wp-graphql-gutenberg

Query gutenberg blocks with wp-graphql
https://wp-graphql-gutenberg.netlify.app
GNU General Public License v3.0
299 stars 62 forks source link

Reusable blocks on page query requires Authentication #128

Open EarthlingDavey opened 2 years ago

EarthlingDavey commented 2 years ago

The example code below requires Authentication. Expected behaviour is for them to be publicly accessible, the same as other blocks. If this behaviour is intentional, then I think it should be in the docs or have a descriptive error message.

Thanks for the plugin, and sorry I don't have the time to dive in and make a PR for a fix.

{
  pages {
    nodes {
      blocks {
        ... on CoreBlock {
          reusableBlock {
            ... on ReusableBlock {
              blocks {
                originalContent
              }
            }
          }
        }
      }
    }
  }
}
jeremyswann commented 2 years ago

I get an error message, not sure why its behind auth either.

{
  "errors": [
    {
      "debugMessage": "get_object_vars(): Argument #1 ($object) must be of type object, array given",
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 11,
          "column": 9
        }
      ],
      "path": [
        "pages",
        "edges",
        0,
        "node",
        "blocks"
      ],
      "trace": [
        {
          "file": ".../wp-content/plugins/wp-graphql-gutenberg-0.3.11/vendor/opis/json-schema/src/Validator.php",
          "line": 1792,
          "function": "get_object_vars(array(1))"
        }
      ]
    }
  ],
  "extensions": {
    "debug": []
  }
}