Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
Hello guys,
I am having problems with creating the product via GraphQL API.
I'm a developer, my team has a backend in AWS that communicates with Shopify GraphQL API.
We faced this problem:
It seems like there is quite big delay between product was created and product will appear in get queries. I tried to simulate this manually and yes, there is delay, about 30 seconds.
This is example of creation request:
mutation productCreate($input: ProductInput!) {
productCreate(input: $input) {
product {
id
variants(first:1) {
edges {
node {
id
}
}
}
}
userErrors {
field
message
}
}
}
and creation variables:
{
"input": {
"title": "Some title",
"descriptionHtml": "Some description",
"collectionsToJoin": [
"gid://shopify/Collection/12345"
],
"variants": [
{
"sku": "SOME_SKU",
"price": 5.99,
"taxCode": "P0000000",
"weight": 2,
"weightUnit": "GRAMS",
"fulfillmentServiceId": "gid://shopify/FulfillmentService/some-fulfillment-service"
}
],
"status": "DRAFT",
"vendor": "Some vendor"
}
}
API returns us 200 OK and ID's of new product and variant that were created
and here is the example of query request:
query productVariants ($sku: String!){
productVariants(first: 1, query: $sku) {
edges{
node {
id
}
}
}
}
and query variables:
{
"sku": "SOME_SKU"
}
What we expect from Shopify to return to us:
{
"data": {
"productVariants": {
"edges": [
{
"node": {
"id": "gid://shopify/ProductVariant/12345"
}
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 3,
"actualQueryCost": 3,
"throttleStatus": {
"maximumAvailable": 2000.0,
"currentlyAvailable": 1997,
"restoreRate": 100.0
}
}
}
}
and what we really get at first 30 seconds:
{
"data": {
"productVariants": {
"edges": []
}
},
"extensions": {
"cost": {
"requestedQueryCost": 3,
"actualQueryCost": 2,
"throttleStatus": {
"maximumAvailable": 2000.0,
"currentlyAvailable": 1998,
"restoreRate": 100.0
}
}
}
}
and only after ~30 seconds we will get the response that we expect (as I mentioned above)
And after all this detailed issue description (maybe too much detailed), my main question is: Where does that delay come from and how to prevent that?
User | RANK |
---|---|
6 | |
5 | |
5 | |
4 | |
4 |