medusajs / medusa

The world's most flexible commerce platform.
https://medusajs.com
MIT License
25.58k stars 2.55k forks source link

Deleting an image does not trigger the delete method of AbstractFileProviderService #8548

Open SummerFans opened 2 months ago

SummerFans commented 2 months ago

Bug report

During the development of the image service module, I found that the delete method in the AbstractFileProviderService type could not be executed, which resulted in the inability to delete images stored by the third-party image service provider.### Describe the bug

A clear and concise description of what the bug is.

System information

Medusa version (including plugins):

Screenshots

image image

Code snippets

// [PATH] @medusajs/utils/dist/file/abstract-file-provider.d.ts
....
// Executed successfully. 
upload(file: FileTypes.ProviderUploadFileDTO): Promise<FileTypes.ProviderFileResultDTO>;

// Unable to execute
delete(file: FileTypes.ProviderDeleteFileDTO): Promise<void>;
....
thetutlage commented 2 months ago

Hello @SummerFans

Can you please share more information on the issue? Like how you are trying to trigger this method and what error do you see? What's the expected outcome.

Bonus: It will be great, if you can put together an example and share it for reproduction with us.

420coupe commented 2 months ago

Hello @SummerFans

Can you please share more information on the issue? Like how you are trying to trigger this method and what error do you see? What's the expected outcome.

Bonus: It will be great, if you can put together an example and share it for reproduction with us.

I know what he's talking about. So when you go to product -> media -> edit / gallery. If you delete one of the images, it does a soft delete in db of the image. But doesn't actually call the file service to delete the image. The one experience i am talking about specifically, is with an S3 provider. (supabase s3) in my instance, There was no delete request being sent when deleting image from product media.

Would also sometimes get a weird error if i tried deleting from the image options vs pressing 'd' on selected images to delete.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 3 days.

SalahAdDin commented 1 month ago

@SummerFans did you check if it was solved in the latest version?

SummerFans commented 1 month ago

@SummerFans did you check if it was solved in the latest version?

I just tried again, but it hasn’t been resolved yet. The upload method can be executed, but the delete function still can’t be triggered. However, the product images are correctly deleted from the product details, while the image provider still retains the deleted images.

SalahAdDin commented 1 month ago

Did you check any log errors in the backend or the browser console?

SummerFans commented 1 month ago

Did you check any log errors in the backend or the browser console?

No warnings of any errors, and manual throw was not triggered either.

SalahAdDin commented 1 month ago

Did you check any log errors in the backend or the browser console?

No warnings of any errors, and manual throw was not triggered either.

Indeed it needs an investigation.

zaheerahmad33 commented 4 days ago

I am getting the same issue