Skip to content

Magento 2.4.6 calling createOrder() causes exception with elasticsearch

In one of my scripts, calling createOrder() ( from vendor/magento/module-sales/Model/AdminOrder/Create.php ) causes an exception:

{"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: id is missing;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: id is missing;"},"status":400}

I’m very confused at these results. Any thoughts?

The rest of the exception text:

#0 /vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php(328): OpenSearchConnectionsConnection->process4xxError()
#1 /vendor/react/promise/src/FulfilledPromise.php(28): OpenSearchConnectionsConnection->OpenSearchConnections{closure}()
#2 /vendor/ezimuel/ringphp/src/Future/CompletedFutureValue.php(65): ReactPromiseFulfilledPromise->then()
#3 /vendor/ezimuel/ringphp/src/Core.php(341): GuzzleHttpRingFutureCompletedFutureValue->then()
#4 /vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php(340): GuzzleHttpRingCore::proxy()
#5 /vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php(238): OpenSearchConnectionsConnection->OpenSearchConnections{closure}()
#6 /vendor/opensearch-project/opensearch-php/src/OpenSearch/Transport.php(113): OpenSearchConnectionsConnection->performRequest()
#7 /vendor/opensearch-project/opensearch-php/src/OpenSearch/Client.php(1389): OpenSearchTransport->performRequest()
#8 /vendor/opensearch-project/opensearch-php/src/OpenSearch/Client.php(210): OpenSearchClient->performRequest()
#9 /vendor/magento/module-open-search/Model/SearchClient.php(172): OpenSearchClient->bulk()
#10 /vendor/magento/module-elasticsearch/Model/Adapter/Elasticsearch.php(312): MagentoOpenSearchModelSearchClient->bulkQuery()
#11 /vendor/magento/module-elasticsearch/Model/Indexer/IndexerHandler.php(186): MagentoElasticsearchModelAdapterElasticsearch->deleteDocs()
#12 /vendor/magento/module-catalog-search/Model/Indexer/Fulltext.php(220): MagentoElasticsearchModelIndexerIndexerHandler->deleteIndex()
#13 /vendor/magento/module-catalog-search/Model/Indexer/Fulltext.php(198): MagentoCatalogSearchModelIndexerFulltext->processBatch()
#14 /vendor/magento/module-catalog-search/Model/Indexer/Fulltext.php(152): MagentoCatalogSearchModelIndexerFulltext->executeByDimensions()
#15 /vendor/magento/module-catalog-search/Model/Indexer/Fulltext.php(250): MagentoCatalogSearchModelIndexerFulltext->execute()
#16 /vendor/magento/framework/Interception/Interceptor.php(58): MagentoCatalogSearchModelIndexerFulltext->executeList()
#17 /vendor/magento/framework/Interception/Interceptor.php(138): MagentoCatalogSearchModelIndexerFulltextInterceptor->___callParent()
#18 /vendor/magento/framework/Interception/Interceptor.php(153): MagentoCatalogSearchModelIndexerFulltextInterceptor->MagentoFrameworkInterception{closure}()
#19 /generated/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Interceptor.php(32): MagentoCatalogSearchModelIndexerFulltextInterceptor->___callPlugins()
#20 /vendor/magento/module-indexer/Model/Indexer.php(533): MagentoCatalogSearchModelIndexerFulltextInterceptor->executeList()
#21 /vendor/magento/module-indexer/Model/Indexer/DependencyDecorator.php(294): MagentoIndexerModelIndexer->reindexList()
#22 /vendor/magento/module-indexer/Model/Indexer/DependencyDecorator.php(299): MagentoIndexerModelIndexerDependencyDecorator->reindexList()
#23 /vendor/magento/framework/Indexer/AbstractProcessor.php(69): MagentoIndexerModelIndexerDependencyDecorator->reindexList()
#24 /vendor/magento/module-catalog-inventory/Observer/ReindexQuoteInventoryObserver.php(84): MagentoFrameworkIndexerAbstractProcessor->reindexList()
#25 /vendor/magento/framework/Event/Invoker/InvokerDefault.php(88): MagentoCatalogInventoryObserverReindexQuoteInventoryObserver->execute()
#26 /vendor/magento/framework/Event/Invoker/InvokerDefault.php(74): MagentoFrameworkEventInvokerInvokerDefault->_callObserverMethod()
#27 /vendor/magento/framework/Event/Manager.php(65): MagentoFrameworkEventInvokerInvokerDefault->dispatch()
#28 /generated/code/Magento/Framework/Event/Manager/Proxy.php(95): MagentoFrameworkEventManager->dispatch()
#29 /vendor/magento/module-quote/Model/QuoteManagement.php(630): MagentoFrameworkEventManagerProxy->dispatch()
#30 /vendor/magento/module-quote/Model/QuoteManagement.php(500): MagentoQuoteModelQuoteManagement->submitQuote()
#31 /vendor/magento/framework/Interception/Interceptor.php(58): MagentoQuoteModelQuoteManagement->submit()
#32 /vendor/magento/framework/Interception/Interceptor.php(138): MagentoQuoteModelQuoteManagementInterceptor->___callParent()
#33 /vendor/magento/module-sales-rule/Plugin/CouponUsagesIncrement.php(54): MagentoQuoteModelQuoteManagementInterceptor->MagentoFrameworkInterception{closure}()
#34 /vendor/magento/framework/Interception/Interceptor.php(135): MagentoSalesRulePluginCouponUsagesIncrement->aroundSubmit()
#35 /vendor/magento/framework/Interception/Interceptor.php(153): MagentoQuoteModelQuoteManagementInterceptor->MagentoFrameworkInterception{closure}()
#36 /generated/code/Magento/Quote/Model/QuoteManagement/Interceptor.php(32): MagentoQuoteModelQuoteManagementInterceptor->___callPlugins()
#37 /vendor/magento/module-sales/Model/AdminOrder/Create.php(2012): MagentoQuoteModelQuoteManagementInterceptor->submit()
#38 /app/code/Bcse/Migration/Model/OrdersProcessor.php(601): MagentoSalesModelAdminOrderCreate->createOrder()