Deleted files but images still linked

Hi there, i have about 1500 products in my database. each with an image. these products are synched via make from airtable.
Because I upload new images, I have a DB trigger that deletes the old image url.

Now for some reason, some products have urls where the file has been deleted.

when I click “see” in the editor, so when opening the image i get this message in my browser:


<Error>

<Code>AccessDenied</Code>

<Message>Access Denied</Message>

<RequestId>V3RCKY20JG8J0YYP</RequestId>

<HostId>O1moZLOePO4l6EaNMwyxTt7kF8DRIn82Q0wGIEwBcPY5jGEOxItRlkZvWMnprdiH1jXQxLPDo/w=</HostId>

</Error>

When I try to find the image in the file manager, the image cannot be found.

Unfortunately I can’t do a DB search for “Image is empty” because the image (url) is NOT empty, but it points to a deleted file. I don’t want to resynch all my products, so how can I identify the products where the linked image has been deleted?

Maybe if the URL is called using an API call and the error is caught, it will be possible to take the needed action, but this needs to be tested to see if it could work!

Hey @salemmo409 , yes that could be an option. Would require looping through all products and calling the attached image URL.
Maybe I will try this