Why Does Graphql Query in Axios Return Only 100 Edges Despite Requesting 150?

This topic was automatically generated from Slack. You can find the original thread here.

Hi Pipedream team, I’ve got a component using Axios to perform a Graphql query against the Jobber app. When I run it, the query returns a totalCount of 110 but only provides 100 edges (I’ve requested the first 150). I could split it into two queries but I’m wondering where the limitation is.

Here’s my code

import { axios } from "@pipedream/platform"
export default defineComponent({
  props: {
    jobber_developer_app: {
      type: "app",
      app: "jobber_developer_app",
    }
  },
  methods: {
    stripWhitespace(queryString) {
      return queryString
        .replace(/\s+/g, ' ') // Replace multiple spaces with a single space
        .trim();              // Remove leading and trailing spaces
    }
  },
  async run({steps, $}) {
    const query = `
      query timeSheetQuery($after: ISO8601DateTime!,$before: ISO8601DateTime!) {
        timeSheetEntries(first:150,
          filter: {
            startAt: {
              after: $after,
              before: $before
            }
          }
        ) {
          totalCount,
          edges {
            node {
              startAt
              endAt
              user {
                id
                name {
                  full
                }
              }
             job {
                id
                jobNumber
                client {companyName}
                title
                jobberWebUri
              }
              label
              note
              finalDuration
            }
          }
        }
      }
    `;
    
    // Clean up the query string to minimize its size, allows for improved readability above
    const cleanedQueryString = this.stripWhitespace(query);

    // after: steps.get_last_job_created.$return_value.createdAt
    const variables = {
      after:  steps.lastThreeSundays.$return_value[1][0],
      before: steps.lastThreeSundays.$return_value[1][2]
    };
    
    const payload = JSON.stringify({ query: cleanedQueryString, variables: variables });
    
    console.log(payload);
    
    return await axios($, {
      method: "post",
      url: `https://api.getjobber.com/api/graphql`,
      headers: {
        Authorization: `Bearer ${this.jobber_developer_app.$auth.oauth_access_token}`,
        "X-JOBBER-GRAPHQL-VERSION": `2024-06-10`,
        "Content-Type": `application/json`,
      },
      data: payload,
    })
  },
})

And the result.

image.png

Pipedream axios is just performing the request, have you tried running the same request in an HTTP request testing tool like Bruno/Insomnia to verify there’s different behavior with the same GraphQL request?

It could be an issue with the Jobber API, not Pipedream

I’ve run it using an http request from Pipedream with the same result. I’ve also tried it using Jobber’s development GraphIQL interface and received all of the data.

Maybe try using vanilla axios in your code step instead of the Pipedream version?

If you see complete results with the same query, then it might be an issue in the Pipedream axios package

seems to be timing outI’ll give it a try

Make sure you remove the $ argument if you go the vanilla axios route

Removing the $ argument resolved the timeout. I’m still only getting 100 edges with the vanilla axios, so I revalidated my assertion about getting all the data from the development GraphIQL interface and found I was wrong. Jobber seems to be paging the data.

Thanks for your input. I’ll have to refactor to use pagination for Jobber.

Thanks for the help !