Magento 2.3 – Fix Bulk Product Attribute Update Error

cronmagento2.3queue

Trying to do a bulk product attribute update in the magento GUI and feedback is that the message is queued. Messages in the database table queue_message seem right, the logs and a manual php bin/magento cron:run have the message:

queue:consumers:start [–max-messages MAX-MESSAGES] [–batch-size BATCH-SIZE] [–area-code AREA-CODE] [–pid-file-path PID-FILE-PATH] [–]

In State.php line 136:

Area code is already set

So for now I've commented out that check in /http/vendor/magento/framework/App/State.php and the jobs run.

It does not seem right to hack the magento core code, but I have done this before for php bin/magento catalog:images:resize for that specific job to skip that and it worked fine – but that was a job I'd expect to run one time only and could revert the change. This is required to be constantly running and to process exports and attribute updates.

Is there any advice you could give me to get this feature working without having to hack the core please?

Best Answer

This is usually due to some other bit of code setting the areaCode before core is trying to set it. Usually because it is trying to be set in __construct() some where. With how dependency injection works, all objects are loaded and their constructors are ran, even if your not using that object. I would check that the areaCode is not being set in a __construct()

Related Topic