A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hello,
Shopify-Admin-API-GraphiQL version 2021-01 is used.
We are attempting to fetch data of orders for one of our clients and are experiencing difficulties. the request failed and the status is INTERNAL_SERVER_ERROR.
There is a lot of data for this client, and even when we tried to fetch the client data only for one day, we got the same error.
According to your suggestions, we minimized the query as much as we could and also added sortKey:'CREATED AT' to the query, as shown below, but we still get the same error.
Query:
mutation {
bulkOperationRunQuery(
query: """
{
orders(query:"(created_at:>'2021-09-25T07:00:00Z' created_at:<'2021-09-25T07:00:00Z') OR (updated_at:>'2021-09-25T07:00:00Z' updated_at:<'2021-09-25T07:00:00Z'),sortKey:'CREATED_AT'")
{
edges
{
node
{
id
createdAt
cartDiscountAmountSet
{
shopMoney
{
amount
}
}
totalDiscountsSet
{
shopMoney
{
amount
}
}
totalPriceSet
{
shopMoney
{
amount
}
}
totalShippingPriceSet
{
shopMoney
{
amount
}
}
totalTaxSet
{
shopMoney
{
amount
}
}
}
}
}
}
"""
) {
bulkOperation {
id
status
}
userErrors {
field
message
}
}
}
Hi @Amichay
Could you please provide the x-request-id header field value for a recent attempt at this bulk mutation? We can take a look in the logs as there may be more information about the error provided there.
Thanks!
To learn more visit the Shopify Help Center or the Community Blog.
We attempted to retrieve the order data again using the query shown above, but we still received the INTERNAL SERVER ERROR.
x-request-id: 0b608ca7-a1f6-486f-b261-b2c173ec60e5
Hi @Amichay
From what I can see in the logs, it looks like your application already had a bulk operation progress when that call was made. However I believe the error message should be more specific. You can try polling the status of the currently running query with the process described here: https://shopify.dev/api/usage/bulk-operations/queries#option-b-poll-your-operation-s-status This will let you see any jobs which is still in progress. If it is complete it will provide a link to the results.
Regards,
To learn more visit the Shopify Help Center or the Community Blog.
Hey,
The bulk operation you saw in progress is from a request that began after the request that received the internal server error message.
We've already polled the status of the currently running query, and it in RUNNING status, until the request encounters an internal error.
The following are the last request statuses:
reportStatus {
id: 'gid://shopify/BulkOperation/610237153347',
status: 'RUNNING',
errorCode: null,
createdAt: '2021-11-16T14:04:19Z',
completedAt: null,
objectCount: '0',
fileSize: null,
url: null,
partialDataUrl: null
}
{
node(id: "gid://shopify/BulkOperation/610237153347") {
... on BulkOperation {
id
status
errorCode
createdAt
completedAt
objectCount
fileSize
url
partialDataUrl
}
}
}
reportStatus {
id: 'gid://shopify/BulkOperation/610237153347',
status: 'FAILED',
errorCode: 'INTERNAL_SERVER_ERROR',
createdAt: '2021-11-16T14:04:19Z',
completedAt: null,
objectCount: '0',
fileSize: null,
url: null,
partialDataUrl: null
}
Hey @Amichay
Just picking up the thread here - if this is still persistent, please feel free to share an X-Request-ID here and we can take a look in the logs - thanks!
Hey,
We still getting the same error (INTERNAL_SERVER_ERROR) for the query that mention in the previous message.
The x-request-id is: 4607a3bc-16c1-46e7-806d-c3dcb32ad3e0
Hey @Amichay
Thanks! I checked the logs and this particular query is causing a DB performance issue, and so Internal Server error was returned. I know you'd mentioned you'd streamlined the query but if it's an option at all to break that main query on orders into seperate run queries for high volume stores, it could be worth considering.
Internal Server Error is a good reason to investigate - particular when errors are consistent. However, there isn't much further our team can go since we currently don't provide authenticated support through these forums, limiting our ability to dig deeper, locate accounts, stores, or much else past generic API logs.
That said, if you can replicate any unexpected response after polling the Bulk Operation status and if feel you are facing an issue, I'd suggest logging any RAW request bodies, returned x-request-id response headers, errors, and then send those along with a short description using our bug reporting tool.
Hey,
We've already reduced the number of fields to a minimum. There are no more fields that can be removed from the request.
All of the fields included in our request are of the basic fields.
There's a chance you could return daily aggregate data from the Order report, which could be useful for us in the meantime.
Hi @Luke_K ,
"break that main query on orders into seperate run queries for high volume stores",
Please explain the solution.