How to send ShopifyQL query to Shopify GraphQL Analytics API ? My query doesn't work

Topic summary

ShopifyQL query sent via the GraphQL Analytics API returns a server-side error (“GraphqlQueryError: Internal error. Looks like something went wrong on our end”).

  • Context: Using the shopifyqlQuery GraphQL field to run an Analytics query and retrieve parseErrors and tableData.

  • Query details: FROM products; VISUALIZE sum(net_sales) AS product_sales; TYPE BAR; GROUP BY product_title; SINCE last_month UNTIL yesterday; ORDER BY product_sales DESC; LIMIT 5.

  • Expected output: Columns, rowData, and unformattedData for a top-5 products sales bar chart; handle parseErrors if any.

  • Technical notes: ShopifyQL is Shopify’s analytics query language; GraphQL is the API transport and schema (shopifyqlQuery field).

  • Current outcome: Server returns an “Internal error,” not a client-side parse error; no indication of parseErrors in response.

  • Status: Unresolved. No identified mistake in the provided query and no confirmation of an API-side issue.

  • Key artifact: Code snippets are central to understanding the issue; no images or attachments.

  • Next steps: None decided; user seeks guidance on what’s wrong or how to successfully execute the query.

Summarized with AI on January 15. AI used: gpt-5.

Helllo. This is the query I’m sending to Shopify GrapgQL API:

query shopifyqlQuery($query: String!){
  shopifyqlQuery(query: $query) {
    parseErrors {
      code
      message
    }
    tableData {
      columns {
        comparedTo
        dataType
        displayName
        name
      }
      rowData
      unformattedData
    }
  }
}

And this is the ShopifyQL query I pass to it:

`
FROM products
VISUALIZE sum(net_sales) AS product_sales
TYPE BAR
GROUP BY product_title
SINCE last_month UNTIL yesterday
ORDER BY product_sales DESC
LIMIT 5
`

I get this error from the server:
“GraphqlQueryError: Internal error. Looks like something went wrong on our end”

I don’t belive it’s something wrong on @Shopify_77 's end, as it would be very unlikely. What am I doing wrong ?