Skip to content

S3 Empty Folder 403 #240

@Liam-Sutcliffe

Description

@Liam-Sutcliffe

Describe the bug

When I try create an empty folder from php artisan tinker I receive a 403.

Expected Behavior

I would expect to receive "= true" and and a folder to be created in my S3 bucket.

Current Behavior

League\Flysystem\UnableToWriteFile Unable to write file at location: 555/. Error executing "PutObject" on "https://s3.eu-west-2.amazonaws.com/bucketname/555/"; AWS HTTP error: Client error: PUT https://s3.eu-west-2.amazonaws.com/bucketname/555/ resulted in a 403 Forbidden response:

AccessDeniedAccess DeniedXXXXXX

Reproduction Steps

Process that fails:
php artisan tinker
Storage::disk('s3')->makeDirectory("555/")

The above works on version 3.6.0 but not 3.8.X which we require for our L10 app.

Processes that work but aren't a solution:
We are running this from an ECS task, if we run "aws s3api put-object --bucket bucketname --key 555/ --content-length 0" from the container it will create the folder.

If we run Storage::disk('s3')->put('555/testfile.txt', file_get_contents('testfile.txt')); it creates folder and the file in S3.

Possible Solution

Temporary solution is to take dummy file: Storage::disk('s3')->put('555/testfile.txt', file_get_contents('testfile.txt'));

Additional Information/Context

No response

SDK version used

3.8.1

Environment details (OS name and version, etc.)

AWS ECS EC2 Launch Type

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.p3This is a minor priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions