Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Products Duplicated in Initial Mapping with UUID, Error on Subsequent Imports #668

Open
mrk-dzie opened this issue Dec 2, 2023 · 7 comments

Comments

@mrk-dzie
Copy link

mrk-dzie commented Dec 2, 2023

Environment and configuration

  1. "akeneo/module-magento2-connector-community": "^104.0"
  2. Akeneo version (Serenity | Growth | 7.0) using uuid for entity mapping

Steps to reproduce

  1. Create a product with the same SKU in Magento and Akeneo
  2. Run the product import job. The import will end with no error, but the product will be duplicated in the database, and mapping is created with the sku attribute for the entity that already existed in Magento before import.
  3. Run the product import job again. The job will end with the error Cardinality violation on the Match code with Magento/Adobe Commerce ID step.

Expected result

Existing products are not duplicated and are correctly mapped with Akeneo UUID code.
image

Actual result

Products are duplicated during the initial mapping and subsequent imports encounter errors due to multiple mappings for the same UUID in akeneo_connector_entities

SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more than 1 row, query was: 
    UPDATE `tmp_akeneo_connector_entities_product` t
    SET `_entity_id` = (
        SELECT `entity_id` FROM `akeneo_connector_entities` c
        WHERE t.`uuid` = c.`code`
            AND c.`import` = "product"
    )

image
image

@krasii
Copy link

krasii commented Dec 8, 2023

The same issue

@mrk-dzie
Copy link
Author

mrk-dzie commented Dec 12, 2023

@krasii
Check out the solution here #669

@rbouma
Copy link

rbouma commented Mar 27, 2024

Same problem here! @mrk-dzie Thanks for the solution. We have applied this in composer patch.

https://patch-diff.githubusercontent.com/raw/akeneo/magento2-connector-community/pull/669.patch

@rbouma
Copy link

rbouma commented Mar 27, 2024

@magentix Also this is breaking for a lot of people so can you have a look at this also?

@pixiemediaweb
Copy link

same issue for our clients. it is not practical to tell users to re-sku all of their products. hopefully sense will prevail soon ;)

@megham2908
Copy link

Hi @mrk-dzie we are also facing the same issue. As per description I understand this patch will help us to skip to create duplicate items in Magento, could you please confirm the following questions regarding patch:

  • Product Id in Magento would stay the same, it won't change, right?
  • Only new product name, or description, or other attributes(imported from Akeneo) would match with existing product.

Thanks in advance.

@indykoning
Copy link

Potentially as an addition to prevent this in the future creating another unique index for import + code
db_schema.xml

...
    <table name="akeneo_connector_entities" resource="default" engine="innodb" comment="Akeneo Connector Entities Relation">
       ...
        <constraint xsi:type="unique" referenceId="AKENEO_CONNECTOR_ENTITIES_IMPORT_CODE">
            <column name="import"/>
           <column name="code"/>
        </constraint>
        ....
    </table>
...

If it will attempt to create more duplicate values the import will break immediately instead of next time you try to run it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants