fulfillment_orders returns 404 not found

Sebastian10
Shopify Partner
7 0 1

When first querying all assigned fulfillment orders via /admin/api/2020-10/assigned_fulfillment_orders.json

there's one fulfillment order with the ID 1694060413039.

X-Request-ID: 3887e96f-75cc-45aa-9729-648834840897

 

However, when then querying it again with /admin/api/2020-10/fulfillment_orders/1694060413039.json

We get a 404 not found error:

{"errors":"Not Found"}

X-Request-Id: 6f4daa25-807d-466a-8821-29fb579ad2b1

 

What's the issue and how can we solve it?

 

We only have this issue with one customer, all other customers are working just fine.
This customer can't ship any orders right now, so this is urgent!

Replies 12 (12)
Ceri-Waters
Shopify Partner
97 5 27

Seen this a few times, my guess would be your location ID. A lot of Apps seem to choose the first location (which is fine), however they don't check if that location is actually disabled.

Sebastian10
Shopify Partner
7 0 1

It's a GET request, we don't specify any location ID here. As I also mentioned in my original post, the same request is working for other customers.

_JB
Shopify Staff
Shopify Staff
836 99 211

Hey @Sebastian10,

You're sending API version 2019-10 in your calls, fulfillmentOrders weren't introduced until the 2020-01 version so updating the version your app uses should fix the issue.

Also note that 2020-10 has been fully deprecated at this point, so continuing to call it will cause your app to be unlisted if it's public. Eventually this version will stop working completely, so it's recommended to update all calls for your app to a new version, our docs for that are here

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Sebastian10
Shopify Partner
7 0 1

Hi @_JB , are you sure you checked the correct request? I'm pretty confident I've used the 2020-10 API.

Just to confirm I took the time to test it again. Please not that I've removed some irrelevant or confidential details from the request examples.

 

Here's how we retrieve currently assigned and pending fulfillment requests:

Request:
GET https://<SHOPNAME>.myshopify.com/admin/api/2020-10/assigned_fulfillment_orders.json

Response HEADER:
HTTP/1.1 200 OK
Date: Fri, 16 Oct 2020 07:28:40 GMT
X-Sorting-Hat-PodId: 110
X-Sorting-Hat-ShopId: 27581251695
X-ShopId: 27581251695
X-ShardId: 110
X-Stats-UserId:
X-Stats-ApiClientId: 1296238
X-Stats-ApiPermissionId: 206445346927
HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 1/80
X-Shopify-Shop-Api-Call-Limit: 1/80
X-Shopify-API-Version: 2020-10
X-Shopify-Stage: production
X-Request-ID: 4fa3b4d4-dcd5-4744-95f3-fcbc8c9bed92
Server: cloudflare
CF-RAY: 5e30107a1c5f2c19-FRA

Response BODY:

[{
"id": 1694060413039,
"shop_id": 27581251695,
"order_id": 2526293295215,
"assigned_location_id": 35972382831,
"request_status": "submitted",
"status": "open",
"supported_actions": [
"cancel_fulfillment_order"
],
"outgoing_requests": [
{
"message": null,
"request_options": {
"notify_customer": true
},
"sent_at": "2020-10-13T07:59:08-04:00",
"kind": "fulfillment_request"
}
],
...
},
...
]

 

 

 

Then we want to request the fulfillment order like this:

Request:
GET https://<SHOPNAME>.myshopify.com/admin/api/2020-10/fulfillment_orders/1694060413039.json 

Response HEADER:
HTTP/1.1 404 Not Found
Date: Fri, 16 Oct 2020 07:35:04 GMT
X-Sorting-Hat-PodId: 110
X-Sorting-Hat-ShopId: 27581251695
X-ShopId: 27581251695
X-ShardId: 110
X-Stats-UserId:
X-Stats-ApiClientId: 1296238
X-Stats-ApiPermissionId: 206445346927
HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 1/80
X-Shopify-Shop-Api-Call-Limit: 1/80
X-Shopify-API-Version: 2020-10
X-Shopify-Stage: production
X-Request-ID: e58fed87-a2b0-47e1-9c32-965a11447b89
cf-request-id: 05d1ee7b7f0000c2e0d217e000000001
Server: cloudflare
CF-RAY: 5e3019d8cd30c2e0-FRA

Response BODY:

{"errors":"Not Found"}

 

 

When I try the exact same request with a different shop it is working!

Sebastian10
Shopify Partner
7 0 1

@_JB can you please support here? We are still waiting for an answer!

_JB
Shopify Staff
Shopify Staff
836 99 211

Hey @Sebastian10,

Sorry for the delay, our developers are investigating this as we speak. I'll post back here as soon as we have an update for you.

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

_JB
Shopify Staff
Shopify Staff
836 99 211

Hey @Sebastian10,

Our team has identified and pushed a fix for the issue. The issue stemmed from work being done on new API features which shouldn't have affected behaviours in stable versions. Our devs have fixed this now so you won't encounter the error when using any of our stable API versions. I just checked our logs again and all calls from your app in the last few weeks have used the unstable API version when calling the fulfillment_orders endpoint. Once you change that to use a stable version (2020-01,2020-04, 2020-07,2020-10) you won't encounter the issue anymore. 

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Sebastian10
Shopify Partner
7 0 1

Hi @_JB , we're currently pinning the API Version 2020-07, but even with the 2020-10 version we're still experiencing the same issue.

When I try to query the fulfillment order, I still get a 404.

Here are a few examples of fulfillment order IDs and the X-Request-ID. All fulfillment orders have been assigned to the App's location. All requests have been sent to the 2020-10 version.

1694750539887 - 668b5b6b-f22b-4564-861d-13c24cef5fb1
1694836850799 - 6d7e548d-18a0-44bf-9054-0575b93de885
1766494404719 - 45748701-97f3-4045-83c5-232bb96796fd

Please have a look at the logs again. Unfortunately the problem is still not solved!

API_Dev
Tourist
4 0 1

I am having the same issues (and many others sprinkled throughout the forums).  I have tried using both Postman and C# code (I have an existing private app ) I receive permission issues when trying to access via Postman and 404s when access via code.

It is many months since your post indicating that Shopify is working on a fix.   Has this been resolved?  

Are there any alternatives to getting the location_Id for an order using the API?  My deadline is rapidly approaching and I am no further ahead after contacting multiple branches of support.

Please review.

Example X-Request-ID(s)   

2021-04 version

Via Postman: 5da3a88a-b1b3-461e-b3bf-e01181d3b2c3 , 99692ed5-e065-4979-91a7-a57f404d65d3
Via Code:  (404 error) ea55d5e2-8465-4143-9340-d0fbf4fbc1b2

Sebastian10
Shopify Partner
7 0 1

Our case got solved only months after writing countless emails with the Shopify Plus support back and forth.

In the end it was some issue with the shop site where something was in a weired state and could only be solved by Shopify directly.

At some point, this was a response from Shopify:

As a refresher, the issue was caused by stale location records preventing the X app from creating a fulfillment service, since the name X was already in use by the stale record. I'm not sure how/when the X app attempts to create a fulfillment service, so depending on the inner workings of the app it might require the app to be removed/reinstalled. That option is safe if there's no concern of losing data from within the app, but if this is a concern I recommend getting input from the X devs. As always, don't hesitate to reach out here if there's anything I can answer.

Not sure if that helps in anyway, but my point is, if you have the same issue as we do, @API_Dev , there's nothing you can do, but only someone at Shopify can solve the issue for you by removing this stale record manually.

If you are only working with a test/dev shop, you could also try to just set up a new shop.

_JB
Shopify Staff
Shopify Staff
836 99 211

@Sebastian10,

Thanks for sharing. Just want to mention for anyone else reading, the issue mentioned above was specific to a single shop, and our devs have since made a change to prevent locations from ending up in a bad state which caused that issue.

@API_Dev,

I checked those requests and there appears to be 2 issues with the call being made.

The app making these calls is missing the required scopes to access fulfillmentOrders. Make sure to request one of the fulfillment_order scopes listed here.

Also the call is being made to a fulfillmentOrder id that doesn't exist. The endpoint being used expects a fulfillment_order_id, but it looks like an order_id is being passed instead. This can be fixed by changing the endpoint URL from /admin/api/2021-04/fulfillment_orders/{{ order_id }}.json to /admin/api/2021-04/orders/{{ order_id }}/fulfillment_orders.json instead.

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Zeeshan007
Tourist
6 0 1

still getting issue 404 not found

{

 path: "fulfillments",
        data: {
          fulfillment: {
            message: "The package was shipped this morning.",
            notify_customer: false,
            tracking_info: {
              number: 1562678,
              url: "https://www.my-shipping-company.com",
              company: "my-shipping-company",
            },
            line_items_by_fulfillment_order: [
              {
                fulfillment_order_id: orderid,
                fulfillment_order_line_items: [{id:10760251899977,quantity:1}],
              },
            ],
          },
        },
        type: DataType.JSON,
}