stackitcloud/stackit-sdk-go

clients.Do ignores context of http.Request

Closed this issue · 3 comments

A stackit client that uses one of the authentication flows internally calls clients.Do to process an http.Request. The latter function creates its context based on context.Background() instead of the (optional) context attached to the http.Request.

ctx, cancel := context.WithTimeout(context.Background(), cfg.RetryTimeout)

That behavior is problematic if the http.Request contains a context with a short timeout of for example only a few seconds. Due to the use of context.Background() that timeout is ignored resulting in exceeded deadlines. Do should instead honor the passed in context.

Hey @vicentepinto98 was this issue accidentally reopened?

@nschad no, I reopened it because I will create new SDK releases that will include the bugfix.
After that I will close the issue.

The fix was included in the latest core release v0.7.7

All of the other SDK modules were also updated to use the latest core