New Shopify Certification now available: Liquid Storefronts for Theme Developers

Shopify Bulk Query Internal Server Error ( When trying to fetch zip in customer addresses)

rohanrajpal
Shopify Partner
38 0 13

If I run the following query

mutation {
  bulkOperationRunQuery(
    query:"""
{
    customers(reverse:true) {
        edges {
            node 
            {
                id
                firstName
                lastName
                email
                phone
                amountSpent {
                    amount
                    currencyCode
                }
                averageOrderAmountV2 {
                    amount
                    currencyCode
                }
                addresses(first: 3) {
                    phone
                    firstName
                    lastName
                    province
                    provinceCode
                    zip
                    city
                    countryCodeV2
                }
                createdAt
                updatedAt
                numberOfOrders
                tags
                displayName
                validEmailAddress
                verifiedEmail
                locale
            }
        }
    }
}
    """
  ) {
    bulkOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}

X-Request-Id of above is 8171846e-09a6-4d36-ae54-ec7fbf1aab50

 

It fails with

{
    "data": {
        "node": {
            "url": null,
            "status": "FAILED",
            "id": "gid://shopify/BulkOperation/2585703612734",
            "partialDataUrl": null,
            "errorCode": "INTERNAL_SERVER_ERROR",
            "createdAt": "2022-11-22T14:28:07Z",
            "objectCount": "0",
            "fileSize": null
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 1,
            "actualQueryCost": 1,
            "throttleStatus": {
                "maximumAvailable": 1000.0,
                "currentlyAvailable": 999,
                "restoreRate": 50.0
            }
        }
    }
}

 

The X-Request-Id is 2ad4fafd-d05f-45c4-aa32-7b8ce3c3cd0f

The error goes away if I remove `zip` from addresses(). This error happens if I add zip, address1 or address2 to the addresses() of customer

Hope I've provided enough info to debug!

Founder | meetspur.com
Feel free to reach out to me at howdyrohan@gmail.com or @rohanrajpal98 on Twitter
Replies 4 (4)
ShopifyDevSup
Shopify Staff
Shopify Staff
1202 190 420

Hi @rohanrajpal 👋

 

Thanks for including the request ID, it was really helpful to determine the cause here! Public apps using version 2022-10 are subject to the protected customer data requirements. I'd recommend checking whether your app has been granted the scopes to access customer addresses. 

 

Hope that helps!

 

 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

rohanrajpal
Shopify Partner
38 0 13

It is! I can fetch the addresses in normal requests, its just the bulk query that is failing

 

If it werent the case I guess the error would have been "protected something error" instead of "internal server error," as usually internal server error means error wasnt handled properly by the server

Founder | meetspur.com
Feel free to reach out to me at howdyrohan@gmail.com or @rohanrajpal98 on Twitter
ShopifyDevSup
Shopify Staff
Shopify Staff
1202 190 420

The logs from the X-Request-ID in your post, there are indications that this may be an access issue. If you would kindly contact us here with your authenticated partner account, we would be happy to share more details. 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

rohanrajpal
Shopify Partner
38 0 13

Just checked, it is indeed because of protected access to address fields. For address field it says "Your access to this field isn't approved at this time. Check your email for more information"

But on checking my email all I have is one email saying my access was approved 🫠

Either shopify folks forgot to send me the reason or there is a bug. Screenshots attached

image (1).pngimage (2).pngimage (3).png

Founder | meetspur.com
Feel free to reach out to me at howdyrohan@gmail.com or @rohanrajpal98 on Twitter