yireo / Yireo_NextGenImages

44 stars 26 forks source link

Type Error occurred when creating object: Yireo\NextGenImages\Image\SourceImage #14

Closed ssstankiewicz closed 2 years ago

ssstankiewicz commented 2 years ago

Hi, I use yireo/magento2-next-gen-images 0.2.8 and yireo/magento2-webp2 0.11.4. It couse critical error: report.CRITICAL: Type Error occurred when creating object: Yireo\NextGenImages\Image\SourceImage, Argument 1 passed to Yireo\NextGenImages\Image\SourceImage::__construct() must be of the type string, null given, called in /www-data/magento/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121

After investigation I found that in vendor/yireo/magento2-next-gen-images/Convertor/DummyConvertor.php:31 you call SourceImage without necessary arguments (vendor/yireo/magento2-next-gen-images/Image/SourceImage.php:22). Works example in vendor/yireo/magento2-webp2/Convertor/Convertor.php:112. Question is what is proper solution for this?

jissereitsma commented 2 years ago

Could you upgrade to the latest version first? Because otherwise we might be wasting both in our times in trying to troubleshoot things that might have been fixed already.

ssstankiewicz commented 2 years ago

My post error (edited right after posting), I have the latest versions.

jissereitsma commented 2 years ago

I'm seeing that the source is full of deprecated code here, which I'm refactoring right now. But where did you encounter this error? In Production Mode? With both modules enabled?

ssstankiewicz commented 2 years ago

Critical error is in Production Mode. Yes, both modules are enabled. Error occurs after ajax request at "/swatches/ajax/media/?product_id=[PRODUCT ID]&isAjax=true".

In developer mode exception is catched at vendor/yireo/magento2-next-gen-images/Plugin/CorrectImagesInAjaxResponse.php:98. If logging is disabled it does nothing

jissereitsma commented 2 years ago

Thanks. The entire AJAX call needed refactoring. I've just released version 0.2.9 which should fix this. Could you upgrade and see if it works for you too?

ssstankiewicz commented 2 years ago

Thank you. It looks good in my local environment. I will confirm it tomorrow after deploy.

ssstankiewicz commented 2 years ago

@jissereitsma Everything is okay