I want to be able to upload images using AWS S3 with a Laravel app deployed on heroku.

When I try to save the image to my s3 bucket, I get the following error:
I didn't know if the bucket itself didn't exist.

Found 1 error while validating the input provided for the PutObject operation:
[Bucket] is missing and is a required parameter
Corresponding source code

I'm trying to put the requested image data in $file and save it as is in the s3 folder.
The contents of $file have been confirmed.

public function confirm (CookingRequest $request, User $user, Cooking $cooking)
        $file = $request->file ('image');
        $path = Storage :: disk ('s3')->put ('/', $file,'public');
        $foods = Session :: get ('foods []');
        $kazu = Session :: get ('kazu []');
        $max = count ($foods);
        for ($i = 0;$i<$max;$i ++) {
            $calories [] = $foods [$i]->calorie * $kazu [$i];
            $proteins [] = $foods [$i]->protein * $kazu [$i];
            $carbo [] = $foods [$i]->carbo * $kazu [$i];

        // $total_calorie = array_sum ($calories);
        return view ('cooking.confirm', compact ('user','menu','foods','path','calories','proteins','carbo','max','kazu'));
What I tried

-Reissue the access and secret access keys and set them in config.
-Unchecked all block public access (bucket settings).
-Clear the cache with the heroku run php artisan cache: clear command.
-Created a new IAM user and bucket and started over.

Supplementary information (FW/tool version, etc.)

Reference article
・ Https://qiita.com/Hiroyuki-Hiroyuki/items/72aed73ff7c0f8508700
・ Https://qiita.com/tiwu_dev/items/ecb115a92ebfebf6a92f
・ Https://qiita.com/RitaChan/items/d59001430f50789c570f

I think there are many points that are difficult to understand and points that are lacking, but I would appreciate your help.

  • Answer # 1

    [Bucket] is missing and is a required parameter

    Is there a bucket specified properly?
    There is no description about the setting, so if you have set it, please describe the setting content.