-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timeout rejections are unhandled #134
Comments
@moltar, many thanks for raising this issue. To reduce error-log pollution, the specific timeout errors are now logged at the |
I don't think it addresses the main problem - which is unhandled exceptions due to naive handling of the promises. Please refer to my repro example. |
Hi @moltar, thanks again for submitting this issue. Question regarding the code sandbox example you provided.
Is the expected behavior that the catch statement is run? If so, this is expected to not occur since the timeout function returns a promise. To catch the error from the promise, we either need to The caller of Does this resolve the issue? Or did I miss something with respect to how the timeout function returns it's errors? |
@bgiori You are totally right. Missed the await in the try block. I am not yet sure if the full issue is solved. What we have observed is that Sentry was reporting every case of timeout. I am not sure if this is because of So it's still unclear how that can happen, if it is a simple |
Have you updated the version you're using in prod to 1.12.1+? If not, give that a shot. If so, a screenshot of the sentry error would be helpful. To avoid posting publicly feel free to email it to me: brian.giori@amplitude.com |
@moltar thank you for your patience regarding this issue. It is possible that the continued Sentry errors are due to timeout errors not being caught for flag fetches when the client is not in |
In this code:
experiment-js-client/packages/experiment-browser/src/transport/http.ts
Lines 18 to 36 in 05c2c38
The timeout rejections will be unhandled, polluting the console with errors, and error reporting tools such as Sentry get flooded with useless errors.
The comment on GH from which this function was copied from states for this to be safe, but indeed it is not.
A small repro is this codesandbox.
A less naive implementation can be found in this package: https://github.com/sindresorhus/p-timeout
The text was updated successfully, but these errors were encountered: