magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.53k stars 9.31k forks source link

Message: Item (Magento\Customer\Model\Customer\Interceptor) with the same ID "6827" already exists #31814

Closed jorgb90 closed 3 years ago

jorgb90 commented 3 years ago

Preconditions (*)

  1. Magento 2.4.1

Steps to reproduce (*)

  1. Imported customer data with Magento tool from Magento 1 to Magento 2
  2. Visit customer overview in new install Magento 2

Expected result (*)

  1. No webapi error

Actual result (*)

  1. Critical: Report ID: webapi-600ad6e880167; Message: Item (Magento\Customer\Model\Customer\Interceptor) with the same ID "6827" already exists

Request URI: /index.php/rest/V1/customers/search?searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bfield%5D=updated_at&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bvalue%5D=2021-01-01%2009:23:26&searchCriteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bcondition_type%5D=gt&searchCriteria%5Bsort_orders%5D%5B0%5D%5Bfield%5D=updated_at&searchCriteria%5Bsort_orders%5D%5B0%5D%5Bdirection%5D=ASC&searchCriteria%5Bpage_size%5D=101&searchCriteria%5Bcurrent_page%5D=1

[2021-01-22 15:18:23] main.CRITICAL: Report ID: webapi-600aecbf05b0d; Message: Item (Magento\Customer\Model\Customer\Interceptor) with the same ID "6827" already exists. {"exception":"[object] (Exception(code: 0): Report ID: webapi-600aecbf05b0d; Message: Item (Magento\Customer\Model\Customer\Interceptor) with the same ID "6827" already exists. at /var/www/vhosts/domain.com/httpdocs/vendor/magento/framework/Webapi/ErrorProcessor.php:208, Exception(code: 0): Item (Magento\Customer\Model\Customer\Interceptor) with the same ID "6827" already exists. at /var/www/vhosts/domain.com/httpdocs/vendor/magento/framework/Data/Collection.php:408)"} []


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

m2-assistant[bot] commented 3 years ago

Hi @jorgb90. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 3 years ago

Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Delta commented 3 years ago

Hi @jorgb90 thank you for your report. Seems like this issue related to Data Migration Tool Could you create issue in appropriate repo and close this one once it will be done?

engcom-Delta commented 3 years ago

@jorgb90 we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.

Timothy-V commented 3 years ago

@jorgb90, did you ever find the solution for this problem? I'm experiencing the same thing with an automatic synchronisation program via api. Magento 2.4.1. This seems to be after I upgraded to the latest Magento version and upgraded the sql database.

Stopping Magento to Exact customer synchronizer. An error occured while getting a list of customers. Response: Internal Error. Details are available in Magento log file. Report ID: webapi-607e89615872c Parameters: lastUpdatedAt '2021-04-02 12:53:19'.

[2021-04-20 07:57:21] main.CRITICAL: Report ID: webapi-607e89615872c; Message: Item (Magento\Customer\Model\Customer\Interceptor) with the same ID "5377" already exists. {"exception":"[object] (Exception(code: 0): Report ID: webapi-607e89615872c; Message: Item (Magento\Customer\Model\Customer\Interceptor) with the same ID \"5377\" already exists. at /data/web/magento2/vendor/magento/framework/Webapi/ErrorProcessor.php:208, Exception(code: 0): Item (Magento\Customer\Model\Customer\Interceptor) with the same ID \"5377\" already exists. at /data/web/magento2/vendor/magento/framework/Data/Collection.php:408)"} []

lenlorijn commented 3 years ago

Has anyone found a solution yet? This error is occurring for us as well after a 2.4.2 upgrade when searching for a customer by email via the API. It is not reproducible locally without customer data.

lenlorijn commented 3 years ago

For anyone finding this thread/issue. Our issue was duplicate newsletter subscribers, perhaps caused by the data-migration-tool.

rangerz commented 3 years ago

@lenlorijn I found a workaround on here

In getList function of vendor/magento/module-customer/Model/ResourceModel/CustomerRepository.php

public function getList(SearchCriteriaInterface $searchCriteria)
{
    ...
    $collection->getSelect()->group('e.entity_id'); # Add this line for workaround

    $this->collectionProcessor->process($searchCriteria, $collection);
    ...
}
Timothy-V commented 3 years ago

For anyone finding this thread/issue. Our issue was duplicate newsletter subscribers, perhaps caused by the data-migration-tool.

Did not use any migration tool, but I found some duplicate email addresses within our newsletters subscribers. It seems the error also shows up when a duplicate email address exists, even though they are splitted by Website. So I deleted every duplicate and the error does not show up anymore! I wonder what will happen now and how long it takes before another duplicate exists. Otherwise I will try the provided solution by Rangerz.

Anyway, thank you very much for sharing Lenlorijn, helped me a lot for now!

jorgb90 commented 3 years ago

For anyone finding this thread/issue. Our issue was duplicate newsletter subscribers, perhaps caused by the data-migration-tool.

Sorry I didnt reply earlier, but this was exactly our problem as well. Remove the duplicate subscriptions and its fixed.

zhukant commented 3 years ago

For anyone finding this thread/issue. Our issue was duplicate newsletter subscribers, perhaps caused by the data-migration-tool.

Same issue for us and this fix worked for us as well, although we did not use any migration tool, either.

yuriichayka commented 3 years ago

Looks like here is the fix - https://github.com/magento/magento2/issues/31168