FileUpload issue with multiple machines

I'm using the FileUpload component, to upload a files in S3. Sample code:
Action::make('i-r')
->button()
->form([
FileUpload::make('r')
->disk('s3')
->directory('tmp')
->visibility('private')
])
->action(function (array $data): void {
if ($data['r'] === null) {
Log::error("Uploading Failed!");
return;
}
dispatch(... job that gets the file and process it);
}),
Action::make('i-r')
->button()
->form([
FileUpload::make('r')
->disk('s3')
->directory('tmp')
->visibility('private')
])
->action(function (array $data): void {
if ($data['r'] === null) {
Log::error("Uploading Failed!");
return;
}
dispatch(... job that gets the file and process it);
}),
When I use only one app machine i.e. vm (scaling), the upload works correctly i.e. 1. the file is uploaded correctly "storage\app\livewire-tmp" when I pick it 2. the file is uploaded to "s3" "tmp" folder when I click the Submit button When I use multiple app machines the file gets uploaded to "storage\app\livewire-tmp", under name like 'JBexfBvW1lJgkJyjxaWYasj09aUWZ3-metaU2FsZXNfUmVwb3J0X0RFQ18yMDIzX0hleUhhcHBpbmVzc19QTC5DU1Y=-.csv' (including the single quotes, which is strange), but when I click the Submit button, it's not uploaded to the S3 folder. In the multiple app engines case it does not work even if it's executed on the app engine on which it was previously worked perfectly (in single single engine mode) Do you have any idea, why when adding second app engine for my application, the uploads stops working? Is there something that I have to configure additionally? Any help will be appreciated.
3 Replies
StanProg
StanProgOP5mo ago
No description
StanProg
StanProgOP5mo ago
I found the problem. Step #1: I pick up the file and it gets uploaded to livewire-tmp folder of machine #1 Step #2: I click the "submit" button, and the system makes the request to machine #2, trying to pick the file from the livewire-tmp folder in order to upload it to S3 "tmp" folder. The file is not in machine #2, so it returns null: BaseFileUpload.php
if (! $file->exists()) {
return null;
}
if (! $file->exists()) {
return null;
}
Now the question is how should I handle such a problem. Any ideas?
awcodes
awcodes5mo ago
Publish the livewire config and change the tmp directory. So it uploads them to s3 instead of local. There’s a section in the livewire docs about this.
Want results from more Discord servers?
Add your server