Accepting or Rejecting a cancellation_request on fulfillment order

jshao
New Member
4 0 0

Following this guide to implement the fulfillment service, when the fulfillment order gets accepted by our fulfillment service, then the merchant try to request for cancellation. The documented way to make the REST API call is failing for both Accept or Reject calls.

 

https://{shop}.myshopify.com/admin/api/2021-10/fulfillment_orders/{fulfillment_order_id}/fulfillment...

https://{shop}.myshopify.com/admin/api/2021-10/fulfillment_orders/{fulfillment_order_id}/fulfillment...

 

When making the call following the guide, what we get back is the response of 422, and the error states

 {"errors":["The fulfillment order is not in an open state."]}

 

Has anyone gotten this to work and might know the issue?

 

Replies 7 (7)

Luke_K
Shopify Staff
402 66 98

Hey @jshao 

Thanks for raising this! By chance do you have a request ID from the request that returned 422? We can take a look - thanks!

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
jshao
New Member
4 0 0

@Luke_K 

 

Requesting a cancel in the UI doesn't work either.

 

Request ID: 98acfc74-8a02-4690-9744-7c8445a42775

{"data":{"fulfillmentOrderSubmitCancellationRequest":{"fulfillmentOrder":null,"userErrors":[{"field":null,"message":"Failed to submit cancel request.","__typename":"UserError"}],"__typename":"FulfillmentOrderSubmitCancellationRequestPayload"}},"extensions":{"cost":{"requestedQueryCost":11,"actualQueryCost":10,"throttleStatus":{"maximumAvailable":5000.0,"currentlyAvailable":4990,"restoreRate":250.0}}}}

 

For accepting the cancel fulfillment request

Request ID: 'X-Request-ID': '37679f18-4173-4618-8d1f-e2f5b6e6e050

b'{"errors":["The fulfillment order is not in an open state."]}'

jshao
New Member
4 0 0

Any update @Luke_K ?

Luke_K
Shopify Staff
402 66 98

Hey @jshao 

 

So, for both of these fulfillment orders involved in those request id(s), at the time the call is made (whether via the Admin or  via the Fulfillment Services API client) the state of them in the database is ‘in progress’, so neither of them are actually not in a state of 'open'. Both of the fulfilment orders request status is  cancellation_requested presently.

 

I checked backstage and this scenario isn’t something that is affecting the platform at scale  - I wasn't able to locate any other open issues where the errors you are facing are present. Not to say it's a non issue though.

 

One question -  Is this happening for any new Fulfillment orders with that specific Fulfillment Service since the last try? I saw the Fulfillment Service has the rights scopes for the calls that are being made.

 

If still receiving the issue, I'd say it's a good idea to raise this in our API bug reporting queue, as on the forums we are restricted into how much we can investigate, which in turn limits what we can pass back to partners in the Community Forums, especially if we require explicit authenticated permission to access to an app or store specifically.

 

While our inability to authenticate here on the forums isn't ideal, we can work around this with those x-request-Id's you've provided. Once authenticated, you can access the beta reporting form at - https://help.shopify.com/en/questions/partners#/contact  -  it sidesteps the above limitation of the forums. Feel free to reference this post if you raise a bug report. Thanks!

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
jcboyer
Shopify Partner
6 0 4

@Luke_K I am also seeing this same behavior using the GraphQL Admin API. My fulfillment order requests are being accepted by my fulfillment service, and the requestStatus and status fields are updated to "ACCEPTED" and "IN_PROGRESS." When I submit the cancellation request through the admin UI, the requestStatus is successfully updated to "CANCELLATION_REQUESTED." However, when my fulfillment service tries to accept the cancellation request, I get the following response from the GraphQL endpoint in the userErrors field: 
{ field: null, message: 'Cannot accept cancellation request for the fulfillment order.' }

Another issue I am seeing that may be related occurs when I make a GraphQL query to get my shop's  assignedFulfillmentOrders with an assignmentStatus of "CANCELLATION_REQUESTED." It is not returning any fulfillment orders even though the fulfillment order mentioned above has the requestStatus "CANCELLATION_REQUESTED." This forces me to query the fulfillmentOrders property on the shop object instead.

TheFlyingCoder
Shopify Partner
8 0 8

Exact same problem here whil developing our fulfillment service.

Cancellation Request notification comes into the system, but when I follow that up with an assignedFulfillmentOrders query for 'CANCELLATION_REQUESTED' status it comes up empty.

 

This is copy - pasted exactly what the documentation says to do with no alterations.

TheFlyingCoder
Shopify Partner
8 0 8

Just updating, it's simply a timing thing... Shopify is too slow updating the status of the cancellation request.

I'll have to put a delay on processing the request