I am using the extension Amasty Product Attachments. If I add an attachment to a product and then delete that attachment from Amasty -> Product Attachments -> Attachments Management, then I can't open the product in the backend anymore. It just loads forever and I get this error logged into the console:
dynamic-rows.js:660 Uncaught TypeError: dataRecord.slice is not a function at UiClass.getChildItems (dynamic-rows.js:660) at UiClass.initChildren (dynamic-rows-grid.js:85) at UiClass.initialize (dynamic-rows.js:191) at UiClass.initialize (wrapper.js:109) at UiClass._super (wrapper.js:106) at UiClass.initialize (dynamic-rows-grid.js:42) at UiClass.initialize (wrapper.js:109) at new UiClass (class.js:49) at Object.initComponent (layout.js:137) at fire (jquery.js:3238)
This is the state if I create a new attachment and assign it to a product:
If I delete the attachment from Amasty -> Product Attachments -> Attachments Management then the record should get removed in both tables, but it is only getting removed in amasty_file:
So the product still thinks that it has the attachment, but can't find it since it was deleted, so the error is getting caused.
Normally the file should get deleted in both because of the foreign key constraint, but the constraint does not work as it seems, even though it exists.
Foreign Key Setup in table amasty_file_store_product:
If I test it on a fresh magento 2, then it works!
So I disabled all third party modules in my not working environment and changed to the Luma default theme, but it still fails.
I am running on Magento 2.4.2 on both. Tested with PHP 7.4 and PHP 7.3.
The code of the extension in the fresh magento 2 is exactly the same as in my environment.
I hope someone has an idea