Error occurred while executing Ajax API requests

I make several Ajax API calls for adding and updating data, but occasionally I encounter some errors such as “Unexpected token ‘<’, "<!DOCTYPE "… is not valid JSON”, “Failed to fetch”, “Network request failed”, “The string did not match the expected pattern.”, and “Load failed.”

I have checked the request body and other request details and did not find any issues. It seems to happen when there are many users accessing my store at the same time.

Has anyone experienced a similar issue, or is there any way to help resolve this?

“I make” – what do you mean by this – what code does the requests – theme Javascript/Flow/your custom app?

Maybe your bucket gets full?

I am only experiencing this issue with the Shopify Ajax APIs (https://shopify.dev/docs/api/ajax/reference/cart). I have checked these APIs and they do not have a rate limit. I am calling these APIs outside of the storefront. I handle errors using try–catch, and when an error is caught, I send the error to my own separate server. The errors I mentioned above are the ones I see logged on my own server.

You did not mention it was Cart API, so I could not have known, right?

Still, if you make these requests from a single server, there will be bot protection and “fair use” rate limiting.

Problems/solution like the below may be relevant in your case.

I only send logs to my own server. The cart API calls are still made outside of the storefront. I only send logs to my server when customers report that they can’t add products to the cart. It seems like you might not fully understand my question.

Yes, english is not my mother tongue, but

means not on the storefront. Not from visitors browsers.

If you’re not giving proper info, then how can you get proper answers?

If they are indeed made from the visitors browsers, then it could be that the requests are made with wrong data. For whatever reasons – page is not fully loaded when call is made, etc.

It’d be a good idea to log the request data as well.
And also to see the diagnostics more than you’ve cared to share.

Great! It’s helpful that the community shared pictures and presentation replays from the event. Attendees can easily access them through the Media Gallery using the purple icon or the direct link, making it easy to revisit sessions and activities.