422 Error Creating Fulfillment for Order

bansavage
Visitor
2 0 1

I'm using the shopify-api-node module to POST an order fulfillment (docs)
422 http error is thrown when creating a fulfillment for one specific order for a merchant. I have the order JSON saved should that be of assistance. Here is a snippet from the thrown error:

{ HTTPError: Response code 422 (Unprocessable Entity)
    at stream.catch.then.data (/Users/{localusername}/Projects/{projectname}/node_modules/got/index.js:386:13)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
  name: 'HTTPError',
  host: undefined,
  hostname: 'wholelattelove.myshopify.com',
  method: 'POST',
  path: '/admin/orders/998723125302/fulfillments.json',
  protocol: 'https:',
  url: undefined,
  statusCode: 422,
  statusMessage: 'Unprocessable Entity'


The order consists of 3 items. 1 is physical. 2 are digitial. Thus, the line items are grouped into was looks like two separate "unfulfillments":

 

unfulfilled-status.png



 

 

 

 

 

 

 

 

 

 

 

 

Everything else in the order json appears fine, so it is puzzling why this order failed. Is it possible for the Shopify support team examine logs for this order? I can supply an order ID.

Replies 7 (7)

bterry
Visitor
2 0 0

I am having the same issue, any isight would be helpful, as this just started today, and hasn't been an issue for the last month.

 

The response that I get back is a 422 Unprcoessable Entity, with the body of the response as:

 

{
"errors": {
"base": [
"An error occurred, please try again"
]
}
}

Ryan
Shopify Staff
499 42 120

Thanks for the report @bansavage , @bterry   Order IDs will definitely help, if you could post them here that would be great.  Another thing to help us troubleshoot would be the X-Request-ID you receive in response from your API call that fails.

Ryan | 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 the Shopify Help Center or the Shopify Blog

bterry
Visitor
2 0 0

Sure, here are some of my orders:

 

1297580228672  
1297480548416
1297543987264
1297443946560
 
My store front is:  legacytouch.myshopify.com
 
Thanks,
Bill
Ryan
Shopify Staff
499 42 120

This does look like an issue, and we are investigating.  We are going to implement a change shortly that we believe will fix these 422 errors.  It looks like they are occurring in situations where your apps are attempting to create a fulfillment with some lines items that are marked as require_shipping: true and others with require_shipping: false.

 

Let me know if you are still encountering this issue moving forward as hopefully this change will prevent the error from re-occurring.

 

EDIT: This was fixed 07-17-2019

Ryan | 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 the Shopify Help Center or the Shopify Blog

namthan
Visitor
1 0 0

@Ryan wrote:

This does look like an issue, and we are investigating.  We are going to implement a change shortly that we believe will fix these 422 errors.  It looks like they are occurring in situations where your apps are attempting to create a fulfillment with some lines items that are marked as require_shipping: true and others with require_shipping: false.

 

Let me know if you are still encountering this issue moving forward as hopefully this change will prevent the error from re-occurring.

 

EDIT: This was fixed 07-17-2019


Hi Ryan,

We're currently facing this error, still: base - An error occurred, please try again

The order got error has only one time with require_shipping: false. Could you please help to identify why it happened?

JeffID
Visitor
2 0 0

I am suffering the same problem but with a single item on a test website:

Result

422 Unprocessable Entity

{

"errors": 
  "Cannot create fulfillment for the fulfillment order."
 

}

 

Create Fulfillment Request
 
{
  "fulfillment": {
    "message": "The package was shipped this morning.",
    "notify_customer": false,
    "tracking_info": {
      "number": "AA1234567890NZ",
      "company": "New Zealand Post",
    },
    "line_items_by_fulfillment_order": [
      {
        "fulfillment_order_id": 2613406630044,
        "fulfillment_order_line_items": [
          {
            "id": 7383807459484,
            "quantity": 1
          }
    ]
      }
    ]
  }
}

 

Fulfillment Order

 

"fulfillment_orders": 

  {
"id": 2613406630044
"shop_id": 49548099740
"order_id": 2819188228252
"assigned_location_id": 56569495708
"fulfillment_service_handle": "pachealth-fulfillment"
"request_status": "submitted"
"status": "open"
"supported_actions": 
  "create_fulfillment"
 
"destination": {
...
}
"line_items": 
  {
"id": 7383807459484
"shop_id": 49548099740
"fulfillment_order_id": 2613406630044
"quantity": 1
"line_item_id": 6151601488028
"inventory_item_id": 38438906921116
"fulfillable_quantity": 1
"variant_id": 36389564711068
}
"outgoing_requests":  ...
"assigned_location": {
...
}
 
}
travisd
Shopify Partner
7 0 5

I found the problem is that you have to first accept the fulfillment request from your fulfillment service before creating the fulfillment. 

 

Check out the acceptFulfillmentRequest mutation here. I don't believe it's possible to accept a fulfillment request through the REST API, but could be wrong.