We use cookies to make your experience better. To comply with the new e-Privacy directive, we need to ask for your consent to set the cookies. Learn more.
Proxy class not generated when running php bin/magento setup:di:compile command
If after running the command php bin/magento setup: di: compile your proxy class was not created, then a possible reason may be that your di.xml has line breaks in the "argument" field.
If you have something like this
<type name="Extmag\Shiplab\Model\LabelRepository">
<arguments>
<argument name="trackRepository" xsi:type="object">
Magento\Sales\Api\ShipmentTrackRepositoryInterface\Proxy
</argument>
</arguments>
</type>
you need to remove line breaks
<type name="Extmag\Shiplab\Model\LabelRepository">
<arguments>
<argument name="trackRepository" xsi:type="object">Magento\Sales\Api\ShipmentTrackRepositoryInterface\Proxy</argument>
</arguments>
</type>
After that, your proxy class will be generated correctly.
We have already reported a bug here https://github.com/magento/magento2/issues/32296
Also, because of this, there may be problems with installing your module on Magento 2.4.0 Commerce on Cloud. An error like this occurs:
report.CRITICAL: Can't create directory /app/generated/code/Magento/Sales/Model/Order/Shipment/TrackRepository/.
Class Magento\Sales\Model\Order\Shipment\TrackRepository\Proxy generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you must add the generated class object to the signature of the related construct method, only. [] []