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

FIX for Asymmetric Transaction Error with ElasticSearch #9930

Closed
phoenix128 opened this issue Jun 13, 2017 · 6 comments
Closed

FIX for Asymmetric Transaction Error with ElasticSearch #9930

phoenix128 opened this issue Jun 13, 2017 · 6 comments
Assignees
Labels
bug report Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@phoenix128
Copy link
Contributor

\Magento\Catalog\Model\Product\Gallery\Processor::addImage does not work with ElasticSearch while importing images programmatically due to undefined index.

Preconditions

  1. Magento CE/EE 2.1.x
  2. ElasticSearch configured

Steps to reproduce

  1. Programmatically add a product image using \Magento\Catalog\Model\Product\Gallery\Processor::addImage
  2. Save the products

Expected result

  1. Product saved with no errors

Actual result

  1. Asymmetric Transaction Error received casue by undefined index "media_type" in \Magento\Elasticsearch\Model\Adapter\DataMapper\ProductDataMapper::getProductMediaGalleryData (line 260)

How to fix:

\Magento\Catalog\Model\Product\Gallery\Processor::addImage around line 181:

       $mediaGalleryData['images'][] = [
            'file' => $fileName,
            'position' => $position,
            'label' => '',
            'disabled' => (int)$exclude,
        ];

Becomes:

       $mediaGalleryData['images'][] = [
            'file' => $fileName,
            'position' => $position,
            'label' => '',
            'media_type' => 'image',
            'disabled' => (int)$exclude,
        ];
@phoenix128
Copy link
Contributor Author

Created Pull Request: #10610

@miguelbalparda
Copy link
Contributor

For a better searchability in the future, can you add the exact error you encountered?

@phoenix128
Copy link
Contributor Author

phoenix128 commented Aug 22, 2017

It is just Asymmetric Transaction Rollback while saving. Nothing more.
Tracking down I found it source in the file I preported in my description.

@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-71801

@magento-team magento-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report labels Aug 23, 2017
@miguelbalparda miguelbalparda self-assigned this Aug 29, 2017
@miguelbalparda
Copy link
Contributor

This should be fixed by #10610

@korostii
Copy link
Contributor

Hi @miguelbalparda,
#10610 seems to fix this on develop branch.
Do you happen to know whether it was fixed for the 2.1.x branch? If it's not then I don't see the point to closing this issue (yet).

By the way, current develop branch seems to represent the future 2.3 version already, so I suspect there might be a need to have that fix back-ported into 2.2.0-preview separately, as well.
Could you confirm that somehow? I am not sure if that's correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

5 participants