-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught TypeError: Argument 2 passed to Aws\Signature\SignatureV4::signRequest() must be an instance of Aws\Credentials\CredentialsInterface, instance of GuzzleHttp\Promise\Promise given #1650
Comments
Thanks for reaching out to us @ErikThiart. Please keep in mind that the default credentials provider looks for credentials in the following locations, and does not take static credentials declared in-code into account.
In addition to this, a credentials provider does not equate to a credentials interface, which is what the
In order to use credentials from the list above via the default credential provider you need to complete the promise returned by the credential provider with $provider = CredentialProvider::defaultProvider();
$credentials = $provider()->wait(); Alternately, if you prefer to keep the credentials in-code, you can declare your Access Key ID and Secret Access Key as separate variables and use those in a $key = 'AccessKeyId';
$secret = 'SecretAccessKey';
$creds = new Credentials($key, $secret); In summary, lines 23-30 in your example need to be changed to do one of the following.
|
Hey, @diehlaws thanks for the detailed response, that is what I did initially, but something does not add up. I am pretty sure we need to include the This is my code
This is the response:
PS: When I do the auth call to get my access key and secret this is what is returned.
Should we not be using that |
Thanks for the additional information! The error response looks like it is being returned by your API rather than the API Gateway service itself. Typically an error message involving a security token (as opposed to a session token) means the IAM credentials in use are incorrect, or the IAM user that the credentials map to has MFA enabled and the MFA token is not being passed in. To answer your question directly, the session token is generally only required for calls that use temporary credentials such as the credentials resultant from a Depending on what you're using for authentication with your API, it may require a session token to properly complete authentication - using the sample PetStore API with the The SigV4 signing looks to be happening correctly with your code, so this appears to be more of an issue with the service. If you continue to experience problems authenticating against your API you may want to open a new support case under the API Gateway service. |
Alright just to give some feedback in case someone else runs into this issue. So I ended up changing this:
to this:
And then added the and then it worked. |
Seems to have some difficulty between the SDK and Guzzle.
Results in:
Fatal error: Uncaught TypeError: Argument 2 passed to Aws\Signature\SignatureV4::signRequest() must be an instance of Aws\Credentials\CredentialsInterface, instance of GuzzleHttp\Promise\Promise given, called in C:\Users\Thor\app\index.php on line 37 and defined in C:\Users\Thor\app\vendor\aws\aws-sdk-php\src\Signature\SignatureV4.php:78 Stack trace: #0 C:\Users\Thor\app\index.php(37): Aws\Signature\SignatureV4->signRequest(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Promise\Promise)) #1 {main} thrown in C:\Users\Thor\app\vendor\aws\aws-sdk-php\src\Signature\SignatureV4.php on line 78
The text was updated successfully, but these errors were encountered: