Livewire s3 storage adapter returns different class instances
I have two projects using s3 to upload Livewire files. I noticed one error in one of these, and debugging the issue I found out that the same code returns two different class instances:
Both projects running:
"league/flysystem-aws-s3-v3": "^1.0",
"league/flysystem-cached-adapter": "~1.0",
"livewire/livewire": "^2.5",
If I execute (used by Livewire when using s3 as temp folder for images):
use Livewire\FileUploadConfiguration;
$adapter = FileUploadConfiguration::storage()->getDriver()->getAdapter();
dd($adapter);
Project 1 gets: Imgur
Project 2 gets: Imgur
For some reason, one project returns the s3 adapter and the other one returns a cached instance with the adapter inside. This breaks the livewire temporary photo preview.
The only difference is this config I have in my filesystem.php:
'cache' => [
'store' => 'redis',
'expire' => 600,
'prefix' => 's3:',
]
So I'm guessing it's coming from here. But I do not know if I'm doing this wrong or it's a Livewire bug.
If this is wrong, then why Laravel is adding the cache. And if this is correct, then I understand Livewire code should check if the adapter is cached?
Please or to participate in this conversation.