klaviyo / magento2-klaviyo

37 stars 51 forks source link

Area Code is already set. #296

Open vipul-evrig opened 1 month ago

vipul-evrig commented 1 month ago

Environment details

PHP version: 8.1.25 Magento version: 2.4.5-p7 Klaviyo extension version: 4.1.0 Anything else that would help a developer reproduce the bug?

Steps to reproduce

Hi,

Error : area code is already set when we run consumers queue command on terminal.

eg. php n98-magerun2.phar queue:consumers:start exportProcessor

It will give the error from bellow code -

Path: vendor/klaviyo/magento2-extension/Helper/ScopeSetting.php Line no: 63 Code: $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);

Please look into this and provide solution as soon as possible. Screenshot from 2024-05-10 10-41-56

Expected result

It should properly working with consumer queue.

Actual result

Error : area code is already set when we run consumers queue command on terminal.

eg. php n98-magerun2.phar queue:consumers:start exportProcessor

It will give the error from bellow code -

Path: vendor/klaviyo/magento2-extension/Helper/ScopeSetting.php Line no: 63 Code: $this->_state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);

Please look into this and provide solution as soon as possible.

Additional information

No response

kamidzi-klaviyo-integrations commented 1 month ago

@vipul-evrig - I am not able to reproduce this. Do you have something specific in your configurations that may assist in reproducing? Could you post the output of running queue:consumers:start with -vvv flag?

vipul-evrig commented 1 month ago

Hello Sir,

I have attached a log file as per your request.

Also I have attached a video on how to reproduce the issue for this.

Please look into this and provide a solution as soon as possible.

https://github.com/klaviyo/magento2-klaviyo/assets/108509982/1e181d39-bfe4-4cd4-982d-6da7dd0f0c16

Area-Code-is-already-set-Issue-296-klaviyo-magento2-klaviyo-14may2024.txt

kamidzi-klaviyo-integrations commented 1 month ago

@vipul-evrig - Just to update you; looking at this, it does appear that there is a method checkAreaCode which has side-effect of attempting to set the Area Code. We are investigating further.

vipul-evrig commented 1 month ago

Hello Sir,

Thank you for your replied.

Please investigate and provide solution.

cykolln commented 1 month ago

@vipul-evrig Thanks for raising - we are unable to recreate locally on the same version of magento with the same version of klaviyo extension installed. Can you be more specific about what export jobs you are trying to run, this will help us recreate and put out a fix.

vipul-evrig commented 1 month ago

Hello Dear,

We are using below export job command in terminal.

php n98-magerun2.phar queue:consumers:start exportProcessor

Also you can try below command bin/magento queue:consumers:start exportprocessor

Please look into this and provide solution.

Thanks,

cykolln commented 1 month ago

@vipul-evrig I understand that you are trying to run the export job command. However running the same command we are unable to recreate unless we know what specific resources are being exported. Please respond with which entity type you are trying to export: image