Charlotte Wells
Charlotte Wells

Reputation: 635

Missing analytics attribute on result

    apollo: {
        analytics: gql `
            query getAnalyticsViews {
                viewer {
                    zones(filter: { zoneTag: "tag" }) {
                        httpRequestsAdaptiveGroups(
                            filter: {
                                clientRequestHTTPHost: "domain.co.uk"
                                date_geq: "2023-01-01"
                                date_leq: "2023-01-24"
                                requestSource: "eyeball"
                            }
                            limit: 1
                        ) {
                            sum {
                            visits
                            edgeResponseBytes
                            }
                        }
                    }
                }
            }
        `
    }

The above is my Apollo GraphQL query, which works fine in Altair and returns the below:

{
  "data": {
    "viewer": {
      "zones": [
        {
          "httpRequestsAdaptiveGroups": [
            {
              "sum": {
                "edgeResponseBytes": 4542764000,
                "visits": 1200
              }
            }
          ]
        }
      ]
    }
  },
  "errors": null
}

This is my views component where I am trying to access the sum, visits:

    <div v-if="analytics">
        {{ analytics.viewer.zones[0].httpRequestsAdaptiveGroups[0].sum.visits }}
    </div>

In console I can see the data I need under said structure which I copied:

analytics.viewer.zones[0].httpRequestsAdaptiveGroups[0].sum.visits

but I am getting error as shown below:

Missing analytics attribute on result

enter image description here

No idea why this isn't working, I've tried conditionally loading it, but hasn't helped, as I said above the data sums, visits is in console(see image), but not in the component :(

Upvotes: 0

Views: 26

Answers (1)

Charlotte Wells
Charlotte Wells

Reputation: 635

Fixed:

The issue I was facing was:

        analytics: gql `
            query getAnalyticsViews {
                viewer {

Needed to be:

       viewer: gql `
            query getAnalyticsViews {
                viewer {

Upvotes: 0

Related Questions