Timeout error

Kudryavika
Shopify Partner
4 0 1

Hello, I'm the developer.
I use graphql. I send the request and receive the response - timeout.

Whet edit product in Shopify , the request is sent to: /admin/internal/web/graphql/core and receive this response:

{"data":{"productUpdate":{"product":{"id":"gid:\/\/shopify\/Product\/4385773322336",....

 

The same response I receive if the number of variants is small (if there are 10 variants - saving is ok). How can I save 100 variants at one time and avoid "timeout"? Timeout error appears after 25 seconds of waiting. 

Because If we save per 1 variant it will take a very long time (when editing product in my app). Is it possible to block (hide) product for editing while it is updating?

===============================
send to /admin/api/unstable/graphql.json

let response = await this.shopify(`mutation productUpdate($input: ProductInput!) {
productUpdate(input: $input) {
product{
title
}
userErrors{
field
message
}
}
}`, {input: params});

response [{ message: 'Timeout', extensions: { code: 'TIMEOUT' } }]

let params = {"id":"gid://shopify/Product/4385773322336","variants":[{"price":56.99,"compareAtPrice":101.99,"inventoryItem":{"cost":56.99,"tracked":true},"inventoryQuantities":{"locationId":"gid://shopify/Location/18961989728","availableQuantity":78},"sku":"14:29;5:100014065;200007763:201336100","imageId":"gid://shopify/ProductImage/13889528037472","options":["Китайw","XL","Белый"]},{"price":56.99,"compareAtPrice":101.99,"inventoryItem":{"cost":56.99,"tracked":true},"inventoryQuantities":{"locationId":"gid://shopify/Location/18961989728","availableQuantity":72},"sku":"14:29;5:361385;200007763:201336100","imageId":"gid://shopify/ProductImage/13889528135776","options":["Китай12","L","Белый"]}, ....100 variants

0 Likes
Visely-Team
Shopify Partner
1838 210 439

I am not sure saving 100 variants in a single request is a good idea, though I understand your scenario. Your option would be to choose a smaller batch. Unfortunately, there is no way you can put a global lock on a product and prevent it from being edited by the merchant from Shopify admin.

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes
Kudryavika
Shopify Partner
4 0 1

Hello, in Shopify admin you can send all variants (even 100) at one time request:
admin/internal/web/graphql/core 

 "operationName":"UpdateProduct","variables":

and this is ok.
How can we save bulk changes in variants - reorder options and edit in a bulk? 

0 Likes
Visely-Team
Shopify Partner
1838 210 439

I am not saying you cannot, I am just saying that development stores can have additional throttling and capacity constraints.

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes
Kudryavika
Shopify Partner
4 0 1

How can we do this if API request doesn't have enough time to be completed for 25 seconds and give a 'timeout' response for 60 variants already, though there are limits 100 variants? 

manhnq94
Excursionist
28 1 1

Hahaha,

I got Timeout a lot of times even with only 1 variant and 7 images.

 

Shopify server seems suck.

0 Likes