Using context.WithDeadline
to set a timeout hides helpful errors
#1697
Labels
feature-request
A feature should be added or improved.
l
Effort estimation: large
p2
This is a standard priority issue
queued
This issues is on the AWS team's backlog
Describe the bug
Following the "Retries and Timeouts" section of the DynamoDB client documentation, I have added a deadline to my call to
GetItem
. This works great for making the call fail when the timeout is exceeded! However, thecontext deadline exceeded
error overwrites helpful error output that the client otherwise would have returned.This makes troubleshooting difficult for "retryable" errors like forgetting to connect to the VPN before running integration tests, particularly for newer teammates who have less context for what might have gone wrong.
Expected Behavior
Run below code, get output like this:
dial tcp [::1]:45666: connect: connection refused
is a super helpful error message, presumably generated by the OS and/or go's networking code. It even tells us the port that we typoed!Current Behavior
Run below code, get output like this:
All we get is the operation we were performing and the fact that the deadline was exceeded, no hint as to why.
Reproduction Steps
Here's a go program that reproduces the issue, as referenced above.
Possible Solution
The error message knows that it's in
DynamoDB: GetItem
, so clearly you all have some control over it. It would be great if it also listed the last retryable error, something like this:Additional Information/Context
Either removing the timeout, limiting the number of retries so it completes before the deadline, or increasing the timeout to be longer than the maximum number of retries will reveal the helpful error.
AWS Go SDK V2 Module Versions Used
go.mod
:Compiler and Version used
go version go1.18 darwin/amd64
Operating System and version
OSX 12.3.1
The text was updated successfully, but these errors were encountered: