We have a custom console command and it was working fine in Magento 2.2.7 , when we move this extension to Magento 2.3 it failed when we running setup:upgrade.

Anyone who have faced exact similar issue. Please do help.

  • 1
    how is your command declared in di.xml?
    – Marius
    Commented Mar 8, 2019 at 11:58

1 Answer 1


Add this to the di.xml file

<type name="Vendor\ModuleName\Command\OrderQueue">
        <argument name="state" xsi:type="object">Magento\Framework\App\State\Proxy</argument>
        <argument name="orderCron" xsi:type="object">Vendor\ModuleName\Order\Proxy</argument>

you can also remove $this->state->setAreaCode(\Magento\Framework\App\Area::AREA_FRONTEND); from the configure method

  • Sorry. fixed the typo
    – Marius
    Commented Mar 8, 2019 at 12:19
  • Please explain to me why this change and even in devdocs has nothing seems changed and more than anything how did you got these information I mean this method is working in 2.3. Please take time and give me some learning :) Commented Mar 8, 2019 at 12:26
  • You're simple terrific mate :) @marius Commented Mar 8, 2019 at 12:26
  • 1
    some of your dependencies or the dependencies of depencencies try to start the session and there is no area code when that happens. The solution is to provide proxy classes as dependencies so nothing else gets instantiated until it is needed.
    – Marius
    Commented Mar 8, 2019 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.