S3 configuraton is giving strange behavior and not working Storage::disk('s3')->files(); InvalidArgumentException with message 'Missing required client configuration options: region: (string)
-
So I am trying to get upload to S3 to work so I can upload files to S3 instead of locally for some large files. But, there appears to be a funny issue going on with the configuration. Notice the error and the .env are correct it just isn't reading properly. From the tinker it is there
as well. I am trying to test uploading to the s3 bucket for files instead of local.error--------------------------------
Storage::disk('s3')->files();
InvalidArgumentException with message 'Missing required client configuration options:region: (string)
ubuntu@ip-172-31-19-230:/var/www/html/bagisto$ php artisan tinker
Psy Shell v0.9.12 (PHP 7.2.24-0ubuntu0.18.04.3 — cli) by Justin HilemanStorage::disk('s3')->files();
InvalidArgumentException with message 'Missing required client configuration options:region: (string)
A "region" configuration value is required for the "s3" service
(e.g., "us-west-2"). A list of available public regions and endpoints can be
found at http://docs.aws.amazon.com/general/latest/gr/rande.html.'quit
Exit: Goodbye
ubuntu@ip-172-31-19-230:/var/www/html/bagisto$ sudo vi .env
ubuntu@ip-172-31-19-230:/var/www/html/bagisto$ php artisan config:clear
Configuration cache cleared!
ubuntu@ip-172-31-19-230:/var/www/html/bagisto$ php artisan config:cache
Configuration cache cleared!
Configuration cached successfully!
ubuntu@ip-172-31-19-230:/var/www/html/bagisto$ php artisan tinker
Psy Shell v0.9.12 (PHP 7.2.24-0ubuntu0.18.04.3 — cli) by Justin Hileman
dd(env('AWS_DEFAULT_REGION'));
^ null
dd(config('filesystems.disks.s3'))
^ array:6 [
"driver" => "s3"
"AWS_ACCESS_KEY_ID" => "xA333333333333"
"AWS_SECRET_ACCESS_KEY" => "/x33333333"
"AWS_DEFAULT_REGION" => "us-west-2"
"AWS_BUCKET" => "xxxxxx"
"AWS_URL" => "https://ov3rt.s3-us-west-2.amazonaws.com/"
]Plus this is the env file setting
FILESYSTEM_DRIVER=local
FILESYSTEM_CLOUD=s3AWS_ACCESS_KEY_ID=A333333333333
AWS_SECRET_ACCESS_KEY=/x33333333
AWS_DEFAULT_REGION=us-west-2
AWS_BUCKET=xxxx
AWS_URL=https://xxxx.s3-us-west-2.amazonaws.com/ -
This is the article I am working off of to test
https://techncareer.com/post/upload-files-aws-s3-bucket-using-laravel
-
@mikeyapina I fixed it I had to change the parameters for s3 in this file and also make sure that their counterparts where in side the .env file without the AWS.. header in the env file
https://github.com/laravel/laravel/blob/master/config/filesystems.php#L58-L64
-
@mikeyapina
Thanks for mentioning the S3 configuration issues with all the possible solution.