I have a public app where new orders are created by our app. A lot of these orders return a 404 if there is an attempt to access them (through either graphql or rest) after they are created. These orders are visible in the admin. Any help would be appreciated, thanks
Hey @Joe_Everett - we can definitely take a look into this, it does sound like potentially unexpected behaviour to me. Could you share the full GraphQL/REST calls you’re using, your app ID and some example order IDs? If you’re able to share an X-Request-ID from the API response headers we send out, that would be very helpful too.
I’ll do some digging on my end to see if we can narrow down what the issue might be.
@Alan_G Thanks Alan! I believe there may be other Shops and orders with the same issue, but these were the ones raised to me
App id: 103750238209
Shop id: 26512621667
Order ids: 6124540297315, 6130332565603, 6124304466019, 6164975976547
I am using gadget.dev so I cannot access the X-Request-ID, I can ask them if they can give them to me if necessary
REST:
import Shopify from 'shopify-api-node';
let shopifyClient = await connections.shopify.forShopDomain(
shopDomain
);
shopifyClient = new Shopify({
shopName: shopifyClient.options.shopName,
accessToken: shopifyClient.options.accessToken,
maxRetries: 10,
apiVersion: "2023-07"
});
let Order = await shopifyClient.order.get(correctid);
// returns 404 for some orders that exist in the admin
Graphql
const shopify = await connections.shopify.forShopDomain(shopDomain);
const GET_ORDER = `
query GetOrder($id: ID!) {
order(id: $id) {
name
tags
closed
createdAt
lineItems(first: 20) {
edges {
node {
id
title
lineItemGroup {
id
title
}
}
}
}
customer{
email
firstName
}
billingAddressMatchesShippingAddress
billingAddress {
address1
address2
city
company
coordinatesValidated
country
countryCode
countryCodeV2
firstName
formatted
formattedArea
id
lastName
latitude
longitude
name
phone
province
provinceCode
timeZone
zip
}
shippingAddress {
address1
address2
city
company
coordinatesValidated
country
countryCodeV2
firstName
formattedArea
id
lastName
latitude
longitude
name
phone
province
provinceCode
timeZone
zip
}
shippingLine {
title
source
code
deliveryCategory
}
app{
name
}
}
}
`
const getOrderName =
await shopify.graphql(GET_ORDER, {
id: correctorderid,
});
console.log("getOrderName")
logger.info(getOrderName)
I have also tried to get the order in a different way
const testquery = `query MyQuery {
orders(query: "someordername", first: 10) {
edges {
node {
email
id
name
note
test
}
}
}
}`
const getOrdersName =
await shopify.graphql(testquery, {
id: correctorderid,
});
// returns edges []
Thanks for sending that my way @Joe_Everett - I think I was able to replicate this. I’ll do some further digging internally here and loop back with you when we have some next steps - thanks for flagging this!
Hey @Joe_Everett - I did some checking on those order IDs you shared on our end, and it looks like these three were created over 60 days ago:
6124540297315, 6130332565603, 6124304466019
If your app doesn’t have the read_all_orders
scope, this could be why those aren’t showing up for you. For the last one though, 6164975976547 - I can’t say for sure why this wouldn’t show up provided you have the read_orders scope enabled on your app since it is within that 60 day data limit (and the other prerequisite customer data access scopes/permissions). That said, we would usually just return a null array for the order object rather than a 404 error.
The read_all_orders scope does need to be requested directly through us here though before it can be implemented in your app config: Shopify API access scopes
If you’re still seeing the issue with order ID 6164975976547 though/if you’re able to replicate the 404 errors and can share the x-request-id headers from the gadget.dev folks I can definitely take a deeper look.
Hope this helps a little bit at lest - let me know if I can clarify anything more on my end here.