I am getting the following error:
JavaScript
x
Missing required client configuration options: region: (string) A “region” configuration value is required for the “s3” service (e.g., “us-west-2”).
Here is my setup (XXX to hide my creds):
.env file:
JavaScript
DO_SPACES_KEY=XXXXX
DO_SPACES_SECRET=XXXX
DO_SPACES_ENDPOINT=https://nyc3.digitaloceanspaces.com
DO_SPACES_REGION=NYC3
DO_SPACES_BUCKET=XXXX
filesystems.php file (under the disks):
JavaScript
'do_spaces' => [
'driver' => 's3',
'key' => env('XXXXX'),
'secret' => env('XXXXX'),
'endpoint' => env('https://nyc3.digitaloceanspaces.com'),
'region' => env('NYC3'),
'bucket' => env('XXXXXX'),
],
Also in filesystems.php file:
JavaScript
‘cloud’ => env('FILESYSTEM_CLOUD’, 'do_spaces’),
in the view file:
JavaScript
function addDocument(Request $req, $projId)
{
$image = $req->file('uploadFile');
$file_name = pathinfo($image->getClientOriginalName(), PATHINFO_FILENAME);
$input['imagename'] = $file_name.'_'.time().'.'.$image->getClientOriginalExtension();
//$destinationPath = public_path('/images');
//$image->move($destinationPath, $input['imagename']);
$destinationPath = $image->store('/', 'do_spaces');
Storage::setVisibility($destinationPath, 'public');
//$data = array('fid'=>$folderId,'fileLoc'=>$input['imagename'],'projId'=>$projId);
//DB::table('documents')->insert($data);
return back();
}
As you can see in the view, I try to store the image on the space and then store the path in the DB which would represent the path to the space.
I cannot get this error to go away; do you see any issues?
Thanks!
Advertisement
Answer
'region' => env('NYC3'),
should be 'region' => env('DO_SPACES_REGION'),