Shopify.Clients.Graphql.query gives TypeError [ERR_INVALID_ARG_TYPE]

Shopify.Clients.Graphql.query gives TypeError [ERR_INVALID_ARG_TYPE]

jborden13
Shopify Partner
10 0 1

I'm unable to execute any queries against the graphql client. Following all examples i can find but the client.query method always throws:

 

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer or Uint8Array. Received undefined

 let session = await Shopify.Utils.loadOfflineSession(shop);
 const client = new Shopify.Clients.Graphql(session.shop, session.accessToken);
 await client.query({
                            data: `{
                                products (first: 10) {
                                  edges {
                                    node {
                                      id
                                      title
                                    }
                                  }
                                }
                              }`,
                           });

throws:

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer or Uint8Array. Received undefined (node:14788) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer or Uint8Array. Received undefined at write_ (_http_outgoing.js:722:11) at ServerResponse.write (_http_outgoing.js:687:15) at Server.<anonymous> (XXX\shopify\dist\index.js:173:34) at Generator.throw (<anonymous>) at rejected (XXX\shopify\dist\index.js:29:65) at processTicksAndRejections (internal/process/task_queues.js:95:5) (Use node --trace-warnings ... to show where the warning was created)

 

What am i missing or doing wrong?  Seems like it should be pretty straight forward, but no queries ever execute successfully against the graphql.  Apologies, this is my first attempt at graphql.  Thank you.

Reply 1 (1)

jborden13
Shopify Partner
10 0 1

Nevermind, I was conflating 2 errors