Linked Questions

Popular Questions

CraftCMS - CraftQL querying globals always returns error

Asked by At

When querying globals from the GraphiQl interface, from my frontend application, or from an API explorer like Insomnia, CraftQL returns an error Trying to get property of non-object.

I am running Craft 3.1.8 and CraftQL 1.3.1.

query getGlobalTest {
  globals {
    ... on GlobalsSet {
      test {
        ... on Test {

The error occurs in vendor/markhuot/craftql/src/Types/Query.php on line 215.

foreach ($setIds as $id) {
  $set = \Craft::$app->globals->getSetById($id, $siteId);
  $sets[$set->handle] = $set;  <-- Error line

This happens when querying anything in globals. I read somewhere that this has to do with Craft updating to UUIDs in Craft 3.1, however, I am not sure.

Related Questions