aws / aws-sdk-php

Official repository of the AWS SDK for PHP (@awsforphp)
http://aws.amazon.com/sdkforphp
Apache License 2.0
6.02k stars 1.22k forks source link

AWS HTTP error: Cannot change a rejected promise to fulfilled #2511

Closed phuclh closed 2 months ago

phuclh commented 2 years ago

Describe the bug

I got this error multiple times when running heavy or multiple tasks in a short time from Lambda function

Error executing "Invoke" on "https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/xxxx/invocations"; AWS HTTP error: Cannot change a rejected promise to fulfilled

Seems there is an issue from Guzzle and this package.

Expected Behavior

Response from Lambda function

Current Behavior

The process is not completed because of an exception from Guzzle

Reproduction Steps

Set up a heavy task that takes 5-10 minutes or 1.000 - 10.000 tasks with concurrency = 10

Possible Solution

No response

Additional Information/Context

No response

SDK version used

3.234.1

Environment details (Version of PHP (php -v)? OS name and version, etc.)

PHP 8.1

phuclh commented 2 years ago

Same issue here: https://github.com/aws/aws-sdk-php/issues/1743

But it is from S3, my case is on Lambda

yenfryherrerafeliz commented 2 years ago

Hi @phuclh, thanks for opening this issue. Just to understand a little bit more your problem, you said that by executing a function from the SDK that takes in between 5-10 minutes will raise the error?, for example:

$lambdaClient = new LambdaClient([
    'region' => 'us-east-2'
]);
$response = $lambdaClient->invoke([
    'FunctionName' => 'MY-LONG-FUNCTION-EXECUTION'
]);

var_dump($response);

If I missed anything please let me know, and if you could please provide a self contained reproducible code so I can better understand your implementation and better reproduce this issue on my end.

Note: Please redact any sensitive information.

Thanks!

phuclh commented 2 years ago

@yenfryherrerafeliz Yes. I can send you the stack trace from Sentry, just let me know where can I send it to you. This is a private project so I cannot put it here. Thank you!

yenfryherrerafeliz commented 2 years ago

Hi @phuclh, let me investigate the best way you can provide those logs, however I need you to please redact any sensitive information from any data you provide to us.

Thanks!

stobrien89 commented 2 years ago

Hi @phuclh,

Apologies for the delay. The best suggestion we can give at this point would be to post the debug logs here and redact any sensitive information. If you've resolved the issue, it'd be helpful if you'd tell us how you did it!

watarukura commented 1 year ago

Hello, I had a similar problem yesterday, my case is SQS with Laravel queue.

[2023-02-21 09:19:22] prd.ERROR: Error executing "ReceiveMessage" on "https://sqs.ap-northeast-1.amazonaws.com/<aws account id>/<sqs queue name>"; AWS HTTP error: Cannot change a rejected promise to fulfilled {"exception":"[object] (Aws\\Sqs\\Exception\\SqsException(code: 0): Error executing \"ReceiveMessage\" on \"https://sqs.ap-northeast-1.amazonaws.com/<aws account id>/<sqs queue name>\"; AWS HTTP error: Cannot change a rejected promise to fulfilled at /var/www/html/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php:195)

aws/aws-sdk-php: 3.219.0 PHP: 8.0.14

devmade commented 1 year ago

Hey, facing the same issue when trying to run a lot of S3 reads/writes in a short time in parallel using multiple Laravel Vapor queues (about a hundred). exception 'Aws\S3\Exception\S3Exception' with message 'Error executing \"ListObjectsV2\" on \"https://project-id.s3.ap-south-1.amazonaws.com/?list-type=2&prefix=folder-name%2F&max-keys=1\"; AWS HTTP error: Cannot change a rejected promise to fulfilled

About 11 out of 100 queus failed with this same exact error message, would appreciate a quick follow up!

yenfryherrerafeliz commented 3 months ago

Hi @phuclh, @watarukura, @devmade, sorry for the delay on this. Would it be possible for any of you to please provide debug logs so we can investigate this deeper. I am unable to reproduce this issue at this time, and hence hard to understand why it happens. You can enable debug logs by providing the flag debug set to true in the client parameters as in the following example:

$client = new S3Client([
    'region' => 'us-east-2',
    'debug' => true
]);

Thanks!

github-actions[bot] commented 2 months ago

This issue has not recieved a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.