Home > Enterprise >  League\\Flysystem\\AwsS3v3\\AwsS3Adapter::__construct(): Argument #1 ($client) must be of type
League\\Flysystem\\AwsS3v3\\AwsS3Adapter::__construct(): Argument #1 ($client) must be of type

Time:12-09

I have installed the s3 flysystem package by running the following composer command in my Laravel 8 project

composer require --with-all-dependencies league/flysystem-aws-s3-v3 "^1.0"

and tried to store a file from the request as

$imageName = $request->file('file')->store('uploads');

I got the following error

League\Flysystem\AwsS3v3\AwsS3Adapter::__construct(): Argument #1 ($client) must be of type Aws\S3Client, Aws\S3\S3Client given, called in D:\Projects\Rescale\vendor\laravel\framework\src\Illuminate\Filesystem\FilesystemManager.php on line 229

CodePudding user response:

try this to upload an image on AWS

$path = Storage::disk('s3')->put('uploads', $request->file('file'));

CodePudding user response:

So it seems ThePHPLeague Flysystem major version got updated (to v2) thus breaking a lot of stuff since latest Laravel depends on "^1.1" (see: https://github.com/laravel/framework/blob/8.x/composer.json#L27).

I've had this error, so my workaround is to use a specific version instead.


  1. Go to composer.json and use latest v1 (see: https://github.com/thephpleague/flysystem-aws-s3-v3/tags).
- "league/flysystem-aws-s3-v3": "^1.0",
  "league/flysystem-aws-s3-v3": "1.0.29",
  1. Run composer update and let composer update your dependencies.
  • Related