Bulk Query for delivery profiles started failing with internal_server_error

simonhaenisch
Shopify Partner
16 1 36

We run an app that bulk-queries a shop's delivery profiles (and products) to generate data. After a couple of days of running that bulk query for all shops that have our app installed, I noticed that the data generation wasn't working for a specific shop, and turns out the bulk operation was failing with code INTERNAL_SERVER_ERROR.

 

I've reported this as an issue via the partner support already a few days ago, however haven't gotten a reply. Now, one of our customers complained to us about their data being outdated, and after checking the logs, I found out that two days ago the bulk operation started failing for their shop as well! It was running fine until around 6 PM on 11 July, and failed with INTERNAL_SERVER_ERROR ever since.

 

Here's the query that's failing as code. I've tried running the bulk query as a normal query and it runs just fine.

 

 

 

const query = `
  mutation createBulkProductQuery($bulkQuery: String!) {
    bulkOperationRunQuery(query: $bulkQuery) {
      bulkOperation {
        id
        status
      }
      userErrors {
        field
        message
      }
    }
  }
`

const bulkQuery = `
  query {
    deliveryProfiles {
      edges {
        node {
          id
          default
          profileItems {
            edges {
              node {
                id
                variants {
                  edges {
                    node {
                      id
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
`

await fetch(`https://${shop}/admin/api/2022-07/graphql.json`, {
  method: 'POST',
  body: JSON.stringify({ query, variables: { bulkQuery } }),
  headers: {
    'content-type': 'application/json',
    'x-shopify-access-token': '...',
  },
})

 

 

 

The bulk operation gets created just fine but then fails later on, i. e. the API returns something like

 

 

{
	"data": {
		"node": {
			"status": "FAILED",
			"errorCode": "INTERNAL_SERVER_ERROR",
			"url": null,
			"objectCount": "30533",
			"rootObjectCount": "3",
			"partialDataUrl": null,
			"fileSize": null,
			"type": "QUERY",
			"query": "query { deliveryProfiles { edges { node { id default profileItems { edges { node { id variants { edges { node { id } } } } } } } } } }"
		}
	}
}

 

 

 

Is there any chance someone can look into the cause of this very soon? I don't have another way of fixing our app for that customer at this point 😞

 

If you need a request ID, you might be able to find the issue I reported via partner support, or I just created a new bulk operation (gid://shopify/BulkOperation/1442356854956) for the shop in question: 

x-request-id: d0e83378-d74c-407a-bc63-ce1c4fab6228

 

Replies 3 (3)

simonhaenisch
Shopify Partner
16 1 36

Update: I've noticed that the bulk operation finishes successfully when I remove the variants sub-query from the profile items and query for the product ID instead.

 

query {
deliveryProfiles {
edges
{
node {
id
default
profileItems {
edges {
node {
id
product {
id
}
}
}
}
}
}
}
}
}

 

So this narrows the cause of the problem down a bit further, however it's not a solution for us, because each variant of a product could potentially belong to a different delivery profile. We need to be able to fetch the delivery profile for each variant so that we can determine the correct shipping cost for it.

simonhaenisch
Shopify Partner
16 1 36

Another update: I eventually figured out that I can turn the query around, fetching the delivery profile per variant instead of the variants per delivery profile.

 

query {
productVariants {
edges {
node {
id
deliveryProfile {
id
}
}
}
}
}

This bulk query seems to work fine so far, however this involved reworking our data processing. Anyway, at least solving the root cause is not urgent for us anymore.

Parcel_Intellig
Shopify Partner
107 1 50

Noticing the same problem @Shopify any fix for this?