aws / aws-sdk-php-laravel

A Laravel 5+ (and 4) service provider for the AWS SDK for PHP
http://aws.amazon.com/sdkforphp/
Apache License 2.0
1.64k stars 242 forks source link

Error retrieving credentials from the instance profile metadata service. #197

Closed arthimann closed 1 year ago

arthimann commented 3 years ago

Confirm by changing [ ] to [x] below:

Version of AWS SDK for PHP? Example: v3.133.6

Version of AWS Service Provider for Laravel? 3.6

Version of Laravel (php artisan --version)? 8.15.0

Version of PHP (php -v)? 7.4.1

Describe the question After running the command: php artisan config:cache for some reason I always got this error:

Error retrieving credentials from the instance profile metadata service

If I'll use the following command: php artisan config:clear it's work fine. Now, to work with the socket server I need those cached config files. Basically, as I understand if I will cache the configuration file, the SDK cannot see the connection credentials. Basically, the issue is not only with only one AWS service it's with all of them (SNS, SES, S3, SQS, etc).

danwall commented 3 years ago

The reason that this happens is that the provided aws_default.php config file does not contain the credentials section which loads from the environment with env().

If you publish the config file aws_publish.php using php artisan vendor:publish --provider="Aws\Laravel\AwsServiceProvider" then as this file does contain the credentials section so using a cached config will work as expected.

This is described in the configuration section of the readme, however it is not clear that the default file is actually different from the default published file.

yenfryherrerafeliz commented 1 year ago

Hi @arthimann, is this a persistent issue for you?, if so, have you tried the recommendation from @danwall in this comment here?, which I confirm that is correct.

Thanks!

github-actions[bot] commented 1 year 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.