GraphQL Admin API response body received quickly, but connection remains open?!

Hi,

It seems something has changed recently with the behaviour of the Shopify GraphQL Admin API endpoint.

I’m calling the Shopify GraphQL API from Python like this:

url = f"https://{shop_id}/admin/api/2025-07/graphql.json"
headers = {
 "Content-Type": "application/json",
 "X-Shopify-Access-Token": access_token,
}

payload = {
 "query": query,
 "variables": variables or {},
}

resp = requests.post(url, json=payload, headers=headers, timeout=1)
resp.raise_for_status()
result = resp.json()

I’m seeing some strange behaviour around request completion time.

With timeout=1, the request succeeds and takes around 1.31s:

x-request-id: fe8dfc8d-02f0-4681-b595-9ba173ea59b0-1778516164
duration: 1.310525s

With timeout=20, the same request also succeeds, but takes around 20.32s:

x-request-id: 07e8ff16-be4d-4fe7-b203-d4c90a338263-1778516357
duration: 20.316896s

With no timeout set, the request eventually completes after around 2m 7s:

x-request-id: 04eea75e-6cf3-4753-912b-a084f5140659-1778516760
duration: 2:07.284663

This makes it look like the GraphQL response body is returned fairly quickly, but the connection is not being closed promptly. The overall request duration seems to depend on the client timeout rather than the actual GraphQL processing time.

The query I make is fetching recent orders with fulfillment orders, line items, fulfillments, product/variant images, and tracking info. Here is the query:

query getOrders($first: Int!, $query: String, $after: String) {
  orders(
    first: $first
    query: $query
    after: $after
    sortKey: CREATED_AT
    reverse: true
  ) {
    pageInfo {
      hasNextPage
      endCursor
    }
    edges {
      node {
        id
        name
        email
        createdAt
        displayFulfillmentStatus
        customer {
          firstName
          lastName
        }
        shippingAddress {
          city
        }
        fulfillmentOrders(first: 10) {
          edges {
            node {
              id
              status
              lineItems(first: 10) {
                edges {
                  node {
                    id
                    totalQuantity
                    remainingQuantity
                    lineItem {
                      id
                      sku
                      name
                      product {
                        title
                        onlineStoreUrl
                        handle
                        featuredImage {
                          url
                        }
                      }
                      variant {
                        id
                        title
                        image {
                          url
                        }
                      }
                    }
                  }
                }
              }
              fulfillments(first: 10) {
                edges {
                  node {
                    id
                    status
                    trackingInfo {
                      company
                      number
                      url
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

With variables:

{
  "first": 10,
  "query": "created_at:>'2026-05-11T15:23:53Z'",
  "after": null
}

Has anyone else seen something similar recently?

Is there a known issue where the Admin GraphQL API returns the response body but keeps the connection open for much longer than expected?

Right now, my “fix” is to set timeout=1

Thank you for your help,

Update: I can only reproduce once the code is deployed on CloudRun, not when running locally. It looks this may be an issue with Python or a proxy between GCP and the endpoint.

I don’t believe it is a Shopify endpoint issue anymore

Update 2: doesn’t work with requests==2.33.1. Works with requests==2.31.0

I will close this thread

Definitely seems like a Google Cloud Run issue, we’re running into it too. There’s some more info on a couple other threads:

Thank you for letting me know about those. I looked but couldn’t find anything

Confirming that our team was able to resolve the problem by forcing the app to use IPv4 as someone noted here Shopify GCP connectivity

Thanks, I also forced IPv4 for all calls to Shopify after seeing the other thread and if fixes it for me too