Skip to content

Signature V4 requires AWS credentials for request signing #252

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

Open
1 task
jack20211101 opened this issue Mar 12, 2025 · 3 comments
Open
1 task

Signature V4 requires AWS credentials for request signing #252

jack20211101 opened this issue Mar 12, 2025 · 3 comments
Assignees
Labels
bug This issue is a bug.

Comments

@jack20211101
Copy link

Describe the bug

I configured [AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY] in .env, and S3Client can be called normally in Windows, but it prompts in Linux: vendor/aws/aws-sdk-php/src/Auth/AuthSchemeResolver.php",85,"Could not resolve an authentication scheme: Signature V4 requires AWS credentials for request signing, I don’t understand why.
Use the following method to work properly:

use Aws\S3\S3Client;
use Aws\Credentials\Credentials;

$credentials = new Credentials('your-access-key-id', 'your-secret-access-key');

$s3Client = new S3Client([
'version' => 'latest',
'region' => 'us-east-1',
'credentials' => $credentials,
]);

In addition, the published configuration file config/aws.php
AWS_REGION should be AWS_DEFAULT_REGION in laravel

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

I hope the configuration reads correctly

Current Behavior

Now, except for the prompt, there is no other

Reproduction Steps

In Linux, it is bound to happen. The OS is AWS Linux 2023

Possible Solution

No response

Additional Information/Context

No response

SDK version used

3.342.4

Environment details (OS name and version, etc.)

Linux 6.1.129-138.220.amzn2023.x86_64

@jack20211101 jack20211101 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 12, 2025
@bredecl
Copy link

bredecl commented Mar 12, 2025

the same happens in macOS 15.3.1, with PHP Version 8.2.4

@stobrien89 stobrien89 removed the needs-triage This issue or PR still needs to be triaged. label Mar 13, 2025
@stobrien89 stobrien89 self-assigned this Mar 13, 2025
@stobrien89
Copy link
Member

Hi all,

Sorry to hear about the issues. Could you both provide me with a little more information on how you're providing AWS credentials to your application? I saw the example @jack20211101 provided above, but (correct me if I'm wrong) it looks like you're just providing an example of something that works for you right now.

@jack20211101
Copy link
Author

jack20211101 commented Mar 17, 2025

Hi all,

Sorry to hear about the issues. Could you both provide me with a little more information on how you're providing AWS credentials to your application? I saw the example @jack20211101 provided above, but (correct me if I'm wrong) it looks like you're just providing an example of something that works for you right now.

My configuration in .env

AWS_ACCESS_KEY_ID=my_id
AWS_SECRET_ACCESS_KEY=my_key

This is config/aws.php

'credentials' => [
'key' => env('AWS_ACCESS_KEY_ID', ''),
'secret' => env('AWS_SECRET_ACCESS_KEY', ''),
],
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'version' => 'latest',
'ua_append' => [
'L5MOD/' . AwsServiceProvider::VERSION,
],

And in Windows config('aws')
The content obtained

array:4 [
"region" => "us-east-1"
"version" => "latest"
"ua_append" => array:1 [
0 => "L5MOD/3.7.0"
]
"credentials" => array:2 [
"key" => "my_id"
"secret" => "AWS_SECRET_ACCESS_KEY"
]
]

In the Linux environment, credentials disappears

array:4 [
"region" => "us-east-1"
"version" => "latest"
"ua_append" => array:1 [
0 => "L5MOD/3.7.0"
]
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants