LambdaClient::invokeWithResponseStream fails because CURLOPT_TCP_KEEPALIVE is passed to Guzzle StreamHandler
- Dominant language
- PHP
- Stars
- 6.2k
- Forks
- 1.3k
- Avg merge
- 2h 53m
- Merged PRs (30d)
- 7
Description
### Describe the bug
### Describe the bug
`LambdaClient::invokeWithResponseStream()` fails with the default client configuration because the Lambda client adds:
```php
CURLOPT_TCP_KEEPALIVE => 1
```
while the request is handled by Guzzle's `StreamHandler`.
This results in:
```text
Passing the "curl" request option to the stream handler is not supported because the stream handler ignores cURL options.
```
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Expected Behavior
invokeWithResponseStream() should work with the default LambdaClient configuration.
### Current Behavior
The call fails with an `Aws\Lambda\Exception\LambdaException`.
### Reproduction Steps
```php
use Aws\Lambda\LambdaClient;
$client = new LambdaClient([]);
$client->invokeWithResponseStream([
'FunctionName' => 'test',
'Payload' => '{}',
]);
```
### Possible Solution
Avoid applying the Lambda client's default cURL options to requests that will be handled by StreamHandler, or ensure InvokeWithResponseStream uses a cURL-capable handler when cURL-specific options are present.
Another possibility would be to special-case InvokeWithResponseStream in the Lambda client's default cURL options middleware.
### Additional Information/Context
_No response_
### SDK version used
3.394.8
### Environment details (Version of PHP (`php -v`)? OS name and version, etc.)
8.5.7
Contributor guide
Assessment
This issue has not been assessed yet.