Stopping retryable function if API call errored #1405
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Recently I've been stuck with using @google-cloud/pubsub package because it was returning an error of
Total timeout of API google.pubsub.v1.Publisher exceeded 60000 milliseconds before any response was received.
I've browsed a couple of issues and StackOverflow answers already, and it seemed pretty vague and irrelevant to my situation, but thanks to the stack trace, It could give me the entry point to start debugging my issue which is located here at the retryable function, when I logged the error I could actually get this output
Error: 14 UNAVAILABLE: Name resolution failed for target DNS:......
After that, I understood that I'd set the service path wrong and could solve my issue.
The problem that I could notice is with the retryable function, we don't ever catch the error at our callback to make use of and return an error if there is any, and since it's not used, we keep failing and just fallback to the maximum number of retries exceeded.
I was able to get the right error directly by setting this codeblock right before setting the canceller to null and keep repeating the request.
and now I could get the error that way
Error: Error: 14 UNAVAILABLE: Name resolution failed for target DNS:....
The impact now is to return back the right error for the end-users so they can investigate their own issues correctly and stop repeating requests in vain. If that makes sense, I can open a PR with that.
Thanks!
The text was updated successfully, but these errors were encountered: