Bug: assignedFulfillmentOrders graphql call returning empty array for cancellation requests

precisionlaser
Excursionist
14 1 0

My app is setup to receive the FULFILLMENT_REQUEST and CANCELLATION_REQUEST requests via a callback endpoint on my server. The fulfillment request side works flawlessly and reliably, but I can't get the cancellation request side to work at all. As an example for this post, I created a test order in my dev store and it arrived at the endpoint complete with all of the fulfillment order information. I accepted the order and then submitted a cancellation request. At the callback, I got a response but only an empty edges array where the product info should have been found. My graphql query is as follows:

{
  shop {
    assignedFulfillmentOrders(first: 10, assignmentStatus: CANCELLATION_REQUESTED) {
      pageInfo {
        hasNextPage
        hasPreviousPage
      }
      edges {
        cursor
        node {
          id
          requestStatus
          merchantRequests(first: 10, reverse: true) {
            edges {
              cursor
              node {
                message
                sentAt
              }
            }
          }
        }
      }
    }
  }
}

This is what I get back:

{
  "errors": false,
  "response": {},
  "status": 200,
  "body": {
    "data": {
      "shop": {
        "assignedFulfillmentOrders": {
          "pageInfo": {
            "hasNextPage": false,
            "hasPreviousPage": false
          },
          "edges": []
        }
      }
    },
    "extensions": {
      "cost": {
        "requestedQueryCost": 133,
        "actualQueryCost": 3,
        "throttleStatus": {
          "maximumAvailable": 1000,
          "currentlyAvailable": 997,
          "restoreRate": 50
        }
      }
    }
  },
  "timestamps": [
    1602981962.5611119
  ]
}

Is this a bug in the api or am I doing something wrong??  Help please

0 Likes
_JB
Shopify Staff
Shopify Staff
834 98 188

Hey @precisionlaser,

Can you share a few example order ids? I'll use this to check the logs and hopefully find more information about why you're seeing an empty response.

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me 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

0 Likes
precisionlaser
Excursionist
14 1 0

Here's an order I just created: 

gid://shopify/FulfillmentOrder/2816594968739

 

As usual, I received the FULFILLMENT_REQUEST callback. I queried for the id(s) and got the order detail back as normal. I never have a problem with this. I then "accepted" the order and verified that it was acknowledged on my test store. I then requested cancellation on my store. The callback was received as usual, and I queried to get the relevant ids as follows:

{
	shop {
		assignedFulfillmentOrders(first: 250, assignmentStatus: CANCELLATION_REQUESTED, locationIds: ["gid://shopify/Location/58250494115"]) {
			edges {
				node {
					id
				}
			}
		}
	}
}

 

I then received the following response which had the empty edges array:

{
    "errors": false,
    "response": {},
    "status": 200,
    "body": {
        "data": {
            "shop": {
                "assignedFulfillmentOrders": {
                    "edges": []
                }
            }
        },
        "extensions": {
            "cost": {
                "requestedQueryCost": 253,
                "actualQueryCost": 3,
                "throttleStatus": {
                    "maximumAvailable": 1000,
                    "currentlyAvailable": 997,
                    "restoreRate": 50
                }
            }
        }
    },
    "timestamps": [
        1608058302.736351
    ]
}

 

I'm guessing I've somehow screwed up but I can't figure out how!

0 Likes
precisionlaser
Excursionist
14 1 0
Sure, I just created this order:
gid://shopify/FulfillmentOrder/2816594968739



As usual, I received the FULFILLMENT_REQUEST callback. I queried for the
id(s) and got the order detail back as normal. I never have a problem with
this. I then "accepted" the order and verified that it was acknowledged on
my test store. I then requested cancellation on my store. The callback was
received as usual, and I queried to get the relevant ids as follows:



{
shop {
assignedFulfillmentOrders(first: 250, assignmentStatus:
CANCELLATION_REQUESTED, locationIds: ["gid://shopify/Location/58250494115"])
{
edges {
node {
id
}
}
}
}
}



I then received the following response which had the empty edges array:



{
"errors": false,
"response": {},
"status": 200,
"body": {
"data": {
"shop": {
"assignedFulfillmentOrders": {
"edges": []
}
}
},
"extensions": {
"cost": {
"requestedQueryCost": 253,
"actualQueryCost": 3,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 997,
"restoreRate": 50
}
}
}
},
"timestamps": [
1608058302.736351
]
}


0 Likes
precisionlaser
Excursionist
14 1 0

Hey @_JB,

I never got any feedback. I'm almost ready for review but there's this one gaping hole. Help please!

0 Likes
_JB
Shopify Staff
Shopify Staff
834 98 188

Hey @precisionlaser,

Do you mind if I preform create some orders+fulfillments on your store? I'm still not sure why the response is empty so I'd like to test myself to see what's happening.

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me 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

0 Likes
precisionlaser
Excursionist
14 1 0
Hi JB

No problem at all. Thank you for your help! What do you need from me to do
this? I have the app setup on my test store Laser Creations and More and I
have a product called Arkansas Cube that is set up for order. If you would
like to speak with me on anything my phone number is 901-481-3285 (US)
0 Likes
precisionlaser
Excursionist
14 1 0

@_JB, no problem at all. I sent a private reply with some info.

0 Likes
precisionlaser
Excursionist
14 1 0

@_JB 

I just submitted a test order, accepted it and then requested cancellation. Same thing with empty edges

0 Likes
_JB
Shopify Staff
Shopify Staff
834 98 188

Hey @precisionlaser,

I copy/pasted your query, but I got an error instead of empty edges. I dug into the logs and it seems the query wasn't working because it was passing a location which wasn't managed by your app. The id used in your query was for the default location created for the shop, but your fulfillment service uses a different location.

I changed the location id in the query to 59084505251 and got back a response containing a FulfillmentOrder:

{
    "shop": {
      "assignedFulfillmentOrders": {
        "edges": [
          {
            "node": {
              "id": "gid://shopify/FulfillmentOrder/2881698234531"
            }
          }
        ]
      }
    }
  }

 

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me 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

0 Likes