Commit aee32c6
committed
fix: use awshttp.BuildableClient in NewAWSSDKHTTPClient to prevent panic in air-gapped regions (#3672)
In air-gapped regions, the AWS SDK's resolveCustomCABundle() needs to inject
custom CA certificates via WithTransportOptions on the HTTP client. Using a
plain *http.Client causes a panic because it cannot be type-asserted to
*awshttp.BuildableClient.
The New() function already correctly uses awshttp.NewBuildableClient(), but
NewAWSSDKHTTPClient() (used by awsutils.go, ec2metadatawrapper.go,
ec2wrapper.go, and imds.go) still returned *http.Client.
Replace &http.Client{Timeout: ...} with awshttp.NewBuildableClient().WithTimeout(...)
to preserve the BuildableClient type while still setting the timeout.
Panic: unable to add custom RootCAs HTTPClient, has no WithTransportOptions, *http.Client1 parent cb7ea5e commit aee32c6
2 files changed
Lines changed: 7 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
42 | | - | |
43 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
65 | | - | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
0 commit comments