craftql icon indicating copy to clipboard operation
craftql copied to clipboard

Querying global returns error: "Trying to get property of non-object"

Open jermashley opened this issue 6 years ago • 7 comments

Howdy all. I'm getting an error every time I try to query globals. This is the query I'm running:

query testGlobal {
  globals(site: "supplyChain") {
    ... on GlobalsSet {
      test {
        ... on Test {
          test
        }
      }
    }
  }
}

This returns:

{
  "error": "Trying to get property of non-object"
}

I have pulled several versions of CraftQL, most resulting in the same error.

If there is more information I need to provide, please let me know.

Edit: I should add that the global Test has only a string input field. This error occurs with most fieldtypes I have used, though.

jermashley avatar Feb 08 '19 19:02 jermashley

Sorry, everyone. 😬 first time making a PR. While I'm not sure this is the correct way to fix the issue, it did solve it locally. I can query globals and the response contains the correct information.

jermashley avatar Feb 11 '19 21:02 jermashley

@jermashley would be nice to know how you solved it locally - I am currently facing the same issue. Can you give any advice?

OFranke avatar Mar 04 '19 11:03 OFranke

@jermashley would be nice to know how you solved it locally - I am currently facing the same issue. Can you give any advice?

I made this change on my local setup and it fixed the issue. https://github.com/markhuot/craftql/pull/224/commits/5228c8f9b6e5a1cc7753310eced1fa67949f56a1

jermashley avatar Mar 12 '19 04:03 jermashley

@jermashley, I left you a comment over here, https://github.com/jermashley/craftql/pull/1

I'll get this merged in if you can update the PR to point to my upstream repo.

markhuot avatar Mar 12 '19 13:03 markhuot

+1. Creating any global and then removing it from craft produces this issue. Unable to query anything from globals afterwards. Fix by @jermashley works.

ParallelUniv3rse avatar Jul 12 '19 10:07 ParallelUniv3rse

Having the same issue. @jermashley thanks for the fix, it works great.

paco-leyva avatar Jul 12 '19 20:07 paco-leyva

Experiencing the same issue.

@markhuot, will you be able to make a release soon?

minyan-gu avatar Aug 16 '19 07:08 minyan-gu