framework: AWS S3 - Missing required client configuration options

  • Laravel Version: 5.8.*
  • PHP Version: 7.3.1
  • Database Driver & Version:

Description:

When trying to upload files to AWS S3, the following error is reported:

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.  

Steps To Reproduce:

Configure environment variables as follows:

FILESYSTEM_DRIVER=s3
FILESYSTEM_CLOUD=s3

AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXX
AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxx
AWS_DEFAULT_REGION=us-east-2
AWS_BUCKET=bucketname
AWS_URL=https://apigateway.us-east-2.amazonaws.com

Has anyone else come across this issue? Am I missing something?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

I know this is closed. i had same issue and different problem. I had copied the .env AWS configuration from one Laravel version to another version. Turns out the config/filesystem AWS variables were different from each Laravel version One version used AWS_DEFAULT_REGION= and Other used AWS_REGION=

if php artisan config:clear doesnt work. It can be that you already have media in your database that points to s3, and when retrieve it tries to resolve the url. When you don’t already have the s3 credentials or commented it out in .env because you switch to another disk, you will get that error. I encountered that error using spatie/laravel-medialibrary

Hi Jessie,

I’m using the spatie/laravel-medialibrary and I got the error when hosting the app on Laravel Forge. Checked every config from tinker and looks correct to me but getting missing configuration error regardless, which local is totally fine. Wondering how do you solve this problem? If there’s something in DB point to S3, what tables I should check? Thank you.

Hey there @Fitmavincent,

I am running into this issue myself, could you solve it?

if php artisan config:clear doesnt work.

It can be that you already have media in your database that points to s3, and when retrieve it tries to resolve the url. When you don’t already have the s3 credentials or commented it out in .env because you switch to another disk, you will get that error.

I encountered that error using spatie/laravel-medialibrary

For reference my fix was to run php artisan config:cache, which wiped the current version of my .env cache and replaced it with the live values.