Order_create Graphql API issue => shipping_lines": Expected "CreateShippingLinesInput", found not an object

Hi
While creating new order using Graphql API we sometime get following issue,

shipping_lines": Expected “CreateShippingLinesInput”, found not an object.

Here is my request, Can you please check what could be the reason? :slightly_smiling_face:

mutation {

order_create(data: {
order_number: “XXXXX”
partner_order_id: “XXXXX”
shop_name: “XXXXX”
order_date: “06-21-2021”
total_tax: “95.6”
subtotal: “478”
total_price: “478”
shipping_lines: {
title: “01F8Q9DAX73BNPX4VMKC3T9DVZ”
price: “63.2”
carrier: “5800”
method: “5800”
}
shipping_address: {
first_name: “XXXXX”
last_name: “XXXXX”
address1: “XXXXX”
city: “XXXXX”
zip: “XXXXX”
country: “XXXXX”
country_code: “XXXXX”
phone: “XXXXX”
}
billing_address: {
first_name: “XXXXX”
last_name: “XXXXX”
address1: “KLINGENBERGGATA 7 B”
city: “XXXXX”
zip: “XXXXX”
country: “XXXXX”
country_code: “XXXXX”
phone: “XXXXX”
}
tags: [
“XXXXX”]
line_items: [
{
sku: “#133
partner_line_item_id: “XXXXX”
quantity: 1
price: “399”
product_name: “XXXXX”
warehouse_id: “XXXXX”
}]
email: “XXXXX”
}) {
complexity
request_id
order {
id
order_number
fulfillment_status
line_items(first: 1) {
edges {
node {
sku
fulfillment_status
quantity
}
}
}
}
}
}

Thanks in advance!

1 Like

I’m new to this but I could maybe help, from what I see the request you have here as an example is correct.

By reading the error it seems that it’s failing because you are passing something else than an object or not the expected object to shipping_lines.

The order_create mutation expect a CreateShippingLinesInput object in shipping_lines:

type CreateShippingLinesInput {
title: String!
price: String!
carrier: String
method: String
}

Something like these would fail:

# not an object
shipping_lines: "a string"
# the wrong object
shipping_lines: { wrong_title: “01F8Q9DAX73BNPX4VMKC3T9DVZ” wrong_price: “63.2” wrong_carrier: “5800” wrong_method: “5800” }
# also not an object
shipping_lines: '{ title: “01F8Q9DAX73BNPX4VMKC3T9DVZ” price: “63.2” carrier: “5800” method: “5800” }'

Since you are getting this error sometimes only, could you print an example of the query when it’s failing? Maybe sometimes the wrong query is being sent?

2 Likes

Hi @hansdaigle

We have found the issue, It was at our end.

Thanks for replying :slightly_smiling_face:

2 Likes

Awesome @khungersumit, i’m glad to hear!

Cheers,

Hans Daigle

1 Like