From time to time, I’m seeing TimeoutError
s in my function logs. After analyzing several specific cases, I’m leaning toward the conclusion that the issue may not lie within my code, but rather on Shopify’s side.
Here’s a typical example from today:
This was a very simple update to a one-line shopping cart.
My Rust-based function responds very quickly in such cases because I’ve implemented a streaming (SAX-style) JSON parser that automatically skips validation for any CART_INTERACTION
steps.
In some cases, I even observe 0 M
in the Instruction Count Usage column.
Unlike the previous JS-based implementation, this new version has not produced a single InstructionCountLimitExceededError
.
Yet, I’m still occasionally receiving these unexpected TimeoutError
s.
Could someone please clarify how the timeout is determined?
Is it possible that the function is actually too fast now?
Would it make sense to introduce a small internal delay to give the system more time to handle the response, or to ensure the receiver is properly attached to STDOUT
?
Hi Eugals - are you still seeing this occur intermittently? Will also check in with the Functions team to see if they have any insight.
Hi @Liam-Shopify
Yes, I’m still seeing those.
I have them both in my JS and in my Rust-based functions.
They would make some sense in the JS version because there are also 15-20K of InstructionCountLimitExceededError
s per day as well.
But I haven’t see a singe InstructionCount error in Rust since it was released, but there are still some TimeoutError
s which is quite odd:
Thanks - I’ve connected with the team working on this and it’s possible this is related to an issue on our side that we’re investigating. Will update here when I learn more.
Also, this is likely not related but we’d recommend that instead of using your own SAX JSON parser, you should use the Shopify_function Rust crate.
Thanks Liam!
I’m looking forward to hearing more about their findings regarding the TimeoutError
issue.
I would have gladly used the standard shopify_function_target
instead of building a custom JSON parser, if that had been feasible. Unfortunately, I found that due to Shopify’s very strict limits on instruction count and especially WASM binary size, a custom parser was the only viable solution.
Since yesterday TimeoutErrors seem to have stopped occurring both in JS and in Rust-based functions now.
There wasn’t a single one in the last 24 hours.
Great to hear you’re not seeing any more timeouts - we did make some updates which should have resolved this.