WordPress / openverse

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
https://openverse.org
MIT License
254 stars 204 forks source link

Retry `ERR_NETWORK` error in Axios requests #2903

Open dhruvkb opened 1 year ago

dhruvkb commented 1 year ago

Description

Axios requests can, in many cases, fail with ERR_NETWORK if the network connection is unstable. These errors must be handled with a certain number of retries followed by a message to the user regarding the error.

sentry-io[bot] commented 1 year ago

Sentry issue: OPENVERSE-FRONTEND-131

ArslanYM commented 1 year ago

How do you plan on alerting the user about the error? Any specific context

dhruvkb commented 1 year ago

@ArslanYM how the user is notified of these failures would depend on the request caller. Once the main causes of these failures are determined, we might need designs for components that can communicate error state to the users (similar to how the skeletons convey loading state).

Currently we are in the step of finding the causes and hotspots in the code where these errors occur.

dhruvkb commented 11 months ago

This could be related to #2612 and #2586.

obulat commented 7 months ago

What is the best solution here, @WordPress/openverse-frontend ? Should we retry the request 2 (or 3 times) before displaying the error page? We recently stopped sending ERR_NETWORK errors to Sentry, sending them to Plausible instead. Would we send the event to Plausible with added attempt number property?

I removed "help wanted" label here because this issue is not actionable in the current state.

sarayourfriend commented 7 months ago

I can't find any example of this issue in Sentry from the last 90 days. @obulat can we close this instead? And if we think there is an issue with needing to retry requests, we can add some specific error handling to cover it.

Would #3721 have affected the visibility of this kind of error at all?

obulat commented 7 months ago

That's right, @sarayourfriend, #3850 (the updated version of #3721) has stopped the ERR_NETWORK from being sent to Sentry. The only exception is /related endpoint (the fix is in #4009)

And if we think there is an issue with needing to retry requests, we can add some specific error handling to cover it.

Since this error is not sent to Sentry anymore, I thought that this issue should handle the setting up of retries after a network error, based on @dhruvkb's note:

These errors must be handled with a certain number of retries followed by a message to the user regarding the error.