Laravel S3 | InvalidArgumentException

Laravel S3 | InvalidArgumentException

I have a laravel project on my local and on the staging server. It works on remote, but I have a problem on my local windows 10 pro machine.

I have a laravel project on my local and on the staging server. It works on remote, but I have a problem on my local windows 10 pro machine.

Here is an error in this line.

 $uploadPath = Storage::disk('s3')->put("$storagePath/$saveName", $file, 'public');

As long as it works on remote, I think that the problem is with environment, but where... I've compared my .env with other team members. It's the same. I've made composer install, composer update, php artisan config:clear - no result.

exception: "InvalidArgumentException"
file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Http\JsonResponse.php"
line: 75
message: "Type is not supported"
trace: [{file: "E:\repos\dcp-laravel\vendor\symfony\http-foundation\JsonResponse.php", line: 50,…},…]
0: {file: "E:\repos\dcp-laravel\vendor\symfony\http-foundation\JsonResponse.php", line: 50,…}
1: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Http\JsonResponse.php", line: 31,…}
2: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\ResponseFactory.php",…}
3: {file: "E:\repos\dcp-laravel\app\Helpers\Traits\APIResponse.php", line: 43, function: "json",…}
4: {file: "E:\repos\dcp-laravel\app\Http\Controllers\FileUploaders\ProposalCoverController.php", line: 59,…}
5: {function: "upload", class: "App\Http\Controllers\FileUploaders\ProposalCoverController", type: "->"}
6: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Controller.php", line: 54,…}
7: {,…}
8: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Route.php", line: 212,…}
9: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Route.php", line: 169,…}
10: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php", line: 665,…}
11: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php", line: 30,…}
12: {,…}
13: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php", line: 151,…}
14: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php", line: 53,…}
15: {,…}
16: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php", line: 151,…}
17: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php", line: 53,…}
18: {,…}
19: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php", line: 151,…}
20: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php", line: 53,…}
21: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php", line: 104,…}
22: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php", line: 667,…}
23: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php", line: 642,…}
24: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php", line: 608,…}
25: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php", line: 597,…}
26: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",…}
27: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php", line: 30,…}
28: {file: "E:\repos\dcp-laravel\vendor\fideloper\proxy\src\TrustProxies.php", line: 57,…}
29: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php", line: 151,…}
30: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php", line: 53,…}
31: {,…}
32: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php", line: 151,…}
33: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php", line: 53,…}
34: {,…}
35: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php", line: 151,…}
36: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php", line: 53,…}
37: {,…}
38: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php", line: 151,…}
39: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php", line: 53,…}
40: {,…}
41: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php", line: 151,…}
42: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php", line: 53,…}
43: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php", line: 104,…}
44: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",…}
45: {file: "E:\repos\dcp-laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",…}
46: {file: "E:\repos\dcp-laravel\public\index.php", line: 55, function: "handle",…}
47: {file: "E:\repos\dcp-laravel\server.php", line: 21, function: "require_once"}

[email protected]

public function upload(ProposalUpdateCover $request)
{
    try {
        $file = $this->coverUploader->upload($request->file('cover'), $this::DEFAULT_UPLOAD_PATH);
        return $this->success_response($file->toArray());
    } catch (\Throwable $exception) {
        return $this->error_response($exception);
    }
}

coverUploader->upload

public function upload(UploadedFile $file, $storagePath = 'file')
{
    $saveName = $this->fileName($file);

    /** Save file to s3 */
    /* !!! Error is here !!!*/
    $uploadPath = Storage::disk('s3')->put("$storagePath/$saveName", $file, 'public');
    $publicUrl = env('AWS_URL').$uploadPath;

    /** Set cover_url - public url */
    $this->file->setAttribute('file_url', $publicUrl);
    /** Set cover_rel - relative path needed for delete file needs */
    $this->file->setAttribute('file_rel', $uploadPath);
    $this->file->save();
    return $this->file;
}

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Clear Cache in Laravel 6.8 App using Artisan Command Interface (CLI)

In Laravel 6 tutorial, we learn how to use PHP artisan command interface (CLI) to clear the cache from Laravel 6.8 application. How To Clear Cache in Laravel 6.8 Application using Artisan Command Line Interface (CLI)? How to clear route cache using php artisan command? How to easily clear cache in Laravel application? How to clear config cache in PHP Laravel via artisan command? How to clear Laravel view cache? How to Reoptimized class in Laravel via artisan CLI?

Get Weather Data with Laravel Weather

Get Weather Data with Laravel Weather. Laravel Weather is a good package which we can use to get weather data. It's a wrapper around Open Weather Map API (Current weather). A wrapper around Open Weather Map API (Current weather)

Laravel Sweet Alert | How to use the SweetAlert package in Laravel PHP

Sweet Alert is a laravel wrapper around #sweetalert javascript library for showing alert or notification message. This is a great package created by rashid, and this laravel package is very famous because it has tonnes of features you can choose from.