I’m using the Shopify GraphQL Refund Query API. However, I frequently encounter the following error:
{
"errors": {
"message": "GraphQL Client: fetch failed"
}
}
The issue is inconsistent — sometimes the query works, and sometimes it doesn’t, even though I haven’t made any changes to the implementation.
What’s even more puzzling is that when this error occurs, I can immediately test the same refund ID using Postman, and the refund API works perfectly without any issues.
Does anyone know what might be causing this problem? Is there something I’m missing or overlooking?
Hi Yoonsoo,
Can you post the full query that you’re trying?
Hi Liam,
Here is the query.
Thank you.
query refund($id: ID!, $first: Int = 250) {
refund(id: $id) {
id
createdAt
updatedAt
return {
id
}
transactions(first: $first, reverse: true) {
nodes {
status
createdAt
}
}
order {
fulfillments(first: $first) {
fulfillmentLineItems(first: $first) {
nodes {
id
quantity
lineItem {
id
}
}
}
}
}
refundLineItems(first: $first) {
nodes {
quantity
lineItem {
id
}
}
}
}
}
Thanks Yoonsoo,
This query does look okay. You mention:
What’s even more puzzling is that when this error occurs, I can immediately test the same refund ID using Postman, and the refund API works perfectly without any issues.
So when you try this from your app you’re seeing this inconsistency? If you try from the GraphiQL app, do you see the same effect? Is this happening only on one store or multiple stores?
@Liam-Shopify
The error occurs regardless of the time.
I haven’t tried using GraphiQL yet, but I immediately tried it using Postman after encountering the error in the application, and it worked fine in Postman.
This issue has only been observed in one store.
Same issue recently occurred with the fulfillment query as well. I’ll attach the fulfillment query here for your reference. Please take a look.
query fulfillment($id: ID!, $first: Int = 250) {
fulfillment(id: $id) {
id
status
displayStatus
name
trackingInfo {
company
number
}
createdAt
deliveredAt
fulfillmentLineItems(first: $first) {
nodes {
id
quantity
lineItem {
id
}
}
}
}
}
@Liam-Shopify
Hi Liam,
The same error consistently occurs.
Is there anything specific I should check or investigate further?
If you’re only seeing this in one store, then I’m thinking that there’s something specific about this store that could be causing this. Is the store a dev store using a developer preview? Are there other apps active that would impact on orders/ refunds?
@Liam-Shopify
Actually, I only operate one store, so I don’t know the other.
I don’t know what development store uses developer preview and I don’t use it either. I use the global-e app regarding orders and refunds but I’m not sure if it has an impact.
Thanks for this context Yoonsoo - how often are you seeing this fail, eg: 10% of time, 20% etc?
If you can include a request header ID for a failed request, that I can use for checking on our side that would be super helpful too.
@Liam-Shopify
Hi Liam,
This error occurs in 7 to 8 out of 10 cases. Moreover, it is an error indicating that the response’s headers do not exist. The API response is exactly as I have attached in the body. There’s not header ID
You mentioned that you haven’t tried in the GraphiQL app - if you do, does it still fail intermittently?