hashicorp / hashicorp/go-retryablehttp

Status 401 Authentication failures do not result in retry behavior

Open
#146 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
2.3k
Forks
298
PR merge metrics
No merged PRs in 30d

Description

I'm trying out retryablehttp, and seeing behavior that I'm not sure is a bug or just my expectation being faulty.

I have an http call to an external service that occasionally, inexplicably, fails with a 401 Authentication error.

Calls to that service in my sample code look like this:

```
req, _ := http.NewRequest("GET", reqURL, nil)
req.Header.Add("Authorization", authHeader)
retryClient := retryablehttp.NewClient()
retryClient.RetryMax = 3

retryreq, err := retryablehttp.FromRequest(req)
if err != nil {
...
}
resp, err := retryClient.Do(retryreq)
```

Here's what I observe:

1. If I force the value for `reqURL` to be an invalid domain, then I see the retry behavior I'd expect in the logs... it tries several times, with exponential backoff, and it's clearly visible in the logs
2. If I use the correct URL, but instead force an authentication failure by passing in incorrect auth credentials, I *do not see* retry behavior... the calls immediately fail with a 401 error. I do see the initial debug log from retryablehttp, but that's it

Thanks for any clarity!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.