Skip to content

Commit 75b0718

Browse files
committed
B2B-2248: WebAPIAsync missing store information when db queue is used
1 parent 8e6d5e8 commit 75b0718

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/code/Magento/WebapiAsync/Model/OperationRepository.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\AsynchronousOperations\Api\Data\OperationInterfaceFactory;
1212
use Magento\AsynchronousOperations\Model\OperationRepositoryInterface;
1313
use Magento\Framework\App\ObjectManager;
14+
use Magento\Framework\Exception\NoSuchEntityException;
1415
use Magento\Framework\MessageQueue\MessageValidator;
1516
use Magento\Framework\Serialize\Serializer\Json;
1617
use Magento\Framework\EntityManager\EntityManager;
@@ -96,8 +97,15 @@ public function create($topicName, $entityParams, $groupId, $operationId): Opera
9697
'entity_id' => null,
9798
'entity_link' => '',
9899
'meta_information' => $encodedMessage,
99-
"store_id" => $this->storeManager->getStore()->getId(),
100100
];
101+
102+
try {
103+
$storeId = $this->storeManager->getStore()->getId();
104+
$serializedData['store_id'] = $storeId;
105+
} catch (NoSuchEntityException $e) {
106+
// skip setting store id in the serialized data if store doesn't exist
107+
}
108+
101109
$data = [
102110
'data' => [
103111
OperationInterface::ID => $operationId,

0 commit comments

Comments
 (0)