productByHandle not returning a product which has just been returned from a previous api call

samdeanconsulti
New Member
2 0 1

Hi,

 

I'm using the iOS sdk to make a call to the Storefront API to get a list of products.

 

{products(first:20,query:"product_type:Mug"){edges{node{title,handle,images(first:1){edges{node{transformedSrc(maxWidth:400,maxHeight:400),originalSrc,altText,id}}}}}}}

I'm then making a call to get more information about a specific product from that list

 

{productByHandle(handle:"handle-from-previous-query"){id,description,images{edges{node{transformedSrc(maxWidth:640,maxHeight:640)}}}}}

However, this is returning no product (null for the productByHandle).

 

I've sanity checked that I'm passing the same value and I am. I've also checked that the handle is correct by viewing on the web and it works.

 

I don't understand this, as the product definitely exists and is visible because it's just been returned from the first api call! 

 

Any suggestions?

0 Likes
SBD_
Shopify Staff
Shopify Staff
1043 141 183

Hey @samdeanconsulti,

 

Are you able to capture a request ID from the response headers?

0 Likes
samdeanconsulti
New Member
2 0 1

Hi,

 

It was a malformed request (I hadn't checked the error because the result wasn't nil - my fault, you even put that in bold in your documentation!)

 

See here for the answer: https://stackoverflow.com/a/61566529/13000

 

Thanks,

Sam