4

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

NIKHIL NEDIYODATH
  • 2,703
  • 5
  • 24
  • 30
  • Does this answer your question? [Unable to upload file in s3 bucket using laravel 5.7- Argument 1 passed to League\Flysystem\AwsS3v3\AwsS3Adapter:](https://stackoverflow.com/questions/64193773/unable-to-upload-file-in-s3-bucket-using-laravel-5-7-argument-1-passed-to-leagu) – miken32 Mar 22 '23 at 16:34

1 Answers1

19

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.
Michael
  • 191
  • 2
  • If the version was specified as ^1.0 then the fact that the package had a v2.0 released would make no difference. Caret means it will not change major versions. – miken32 Mar 22 '23 at 16:25