What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Getting INTERNAL SERVER ERROR using Admin GraphiQL API

Getting INTERNAL SERVER ERROR using Admin GraphiQL API

Amichay
Shopify Partner
40 1 5

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
}
}
}

 

 

Replies 9 (9)

csam
Shopify Staff (Retired)
267 40 51

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.

Amichay
Shopify Partner
40 1 5

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

csam
Shopify Staff (Retired)
267 40 51

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.

Amichay
Shopify Partner
40 1 5

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
}

Luke_K
Shopify Staff
402 66 102

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!

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
Amichay
Shopify Partner
40 1 5

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

Luke_K
Shopify Staff
402 66 102

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.

 

You can get to the bug reporting tool by following this link to authenticate your account, and select the new option to "Report an issue [BETA]". We can't guarantee all requests or bugs reported here are answered directly, but I would thoroughly encourage you to use this option. 

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
Amichay
Shopify Partner
40 1 5

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.

 

Amichay
Shopify Partner
40 1 5

Hi @Luke_K ,

 

"break that main query on orders into seperate run queries for high volume stores",

 

Please explain the solution.