-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Magento 2.2.0rc23: Customer Grid Indexer not working #10838
Comments
Same issue on 2.1.8 and 2.1.7 |
@jhruehl thank you for your report. Unfortunately, we can't guarantee that 3-rd party modules will work with newest Magento versions correctly if they depend on internal Magento code and not on code which marked with @api. |
Nonsense. There is no third party module involved. Checked it by deactivating them all. And even the stack trace makes it quite obvious that its not a third party module. And the Customer Grid Indexer works just fine until updating to 2.2.0rc3.0. So my guess is that you changed the Customer Grid Reindexer process in a way and forgot about Customer Attributes, which have the 'visible in grid' option set. Because that is the most probable reason why the Customer Grid Indexer calls the Attribute Handler. |
@jhruehl yeah, I was wondering how it is identified as a third-party module issue from the screenshot as well. Is the issue still reproducible for you on latest |
@orlangur Yes, it is. But I'm going to try to reproduce it now in our vanilla m2.2.0rc3 store test server by adding a customer attribute with 'visible in grid' set to yes. |
Sadly I couldn't reproce the Cutomer Grid Indexer problem with just adding the same attribute to the vanilla store we have already implemented. So I need to investigate further by debugging. But it could be that the massive difference between our productive customer data (where some incoherence snuggled in over the years) and the few (actually two customers), which are set in the vanilla installation. |
There is a patch for this problem MDVA-4538_EE_2.1.4_v2 |
@VoidWalker |
I was actually able to reproduce it in our vanilla m2.2.0rc3.0 store. In my first run, I didn't set 'is_used_in_grid'. Going to open a new Issue, because otherwise it probably gets ignored. |
@jhruehl could you check the latest |
@orlangur Isn't the 2.2.0rc3.0 Version the latest Preview? |
It is the last RC probably, but the branch was updated after that: https://github.com/magento/magento2/tree/2.2.0-preview |
Just looked at the problematic classes in the 2.2.0 and the 2.2.1-preview. They haven't been updated since then. So I don't really see the point to invest a lot of time into an update process to a preview branch, if the function addAttributeToSelect() is still missing in the Source class and still called in the AttributeHandler class. |
So even the folders '/lib/internal/Magento/Framework/Indexer/' and 'Magento/Customer/Model/Indexer/' were not updated for a month, which leads to the conclusion that going into a probably not composer supported update will be just a waste of time leading to the same results. |
Sure, makes sense to me. |
@magento-engcom-team please provide some insight on #10838 (comment), looks like the issue is reproducible on vanilla installation as well. |
@orlangur Thanks a lot for your help. |
@magento-engcom-team The key to reproduce the problem is setting up a customer eav attribute, which has the 'is_used_in_grid' option set to 1. |
Here is the latest command line stack trace from our vanilla magento 2.2.0rc3.0 installation: Fatal error: Uncaught Error: Call to undefined method Magento\Customer\Model\Indexer\Source::addAttributeToSelect() in /mnt/host/projects/clients/magento2-vanilla/src/www/lib/internal/Magento/Framework/Indexer/Handler/AttributeHandler.php:38 |
@jhruehl it would be great if you can submit pull request if you know how to fix the issue |
@okobchenko The solution seems not be just a simple fix, but looking at the code structure a public function addAttributeToSelect() needs to be implemented in the Magento\Customer\Model\Indexer\Source class as there a similar functions like addFieldToSelect() implemented by passing the requests to other injected classes, which have the needed functionality already implemented. Though it seems that the by dependency injection reachable addAttributeToSelect() functions don't work without further adjustments in that case, because I tried to simply copy them into the problemtatic Source class without real adjustments and this mostly lead to the attribute not being found, because the right tables to join with weren't addressed. But it seems a good approach would be similar to Magento/Catalog/Model/ResourceModel/Category/Flat/Collection::addAttributeToSelect(), but as I already stated needs to be adjusted to join with the right tables and probably some more. |
@okorshenko I feel like it make sense to repeat. There is a patch for this issue MDVA-4538_EE_2.1.4_v2 |
Here ist the patch that solves the problem. Though I don't really get why Magento did leave this function out. And if you look at the content of the MDVA-4538_EE_2.1.4_v2 patch, it seems that the 2.1.4 EE version of Magento already used the same indexer logic as CE 2.2 uses now. It would be really interesting to know what the thought behind that different implementation was. |
@agata-maksymiuk I agree with you, having an extra attribute on customer's grid is possible only if the attribute type is changed in eav table to static |
@pfortin-expertime answer from @selusi is the good one! if you take my answer you won't be able to save data |
Just FYI: I've got confirmation from the Magento Cloud support that this issue should get fixed in Magento 2.2.4 The fix should be: diff --git a/vendor/magento/framework/Indexer/Handler/AttributeHandler.php b/vendor/magento/framework/Indexer/Handler/AttributeHandler.php
index 94f34ec..4b74ce5 100644
--- a/vendor/magento/framework/Indexer/Handler/AttributeHandler.php
+++ b/vendor/magento/framework/Indexer/Handler/AttributeHandler.php
@@ -35,7 +35,7 @@ class AttributeHandler implements HandlerInterface
'left'
);
} else {
- $source->addAttributeToSelect($fieldInfo['origin'], 'left');
+ $source->addFieldToSelect($fieldInfo['origin'], 'left');
}
}
} Looks like there is a pending PR which should fix this: #12729 |
Fixed issues: - MAGETWO-81802: Magento 2.2.0rc23: Customer Grid Indexer not working #10838 - MAGETWO-84448: Product Import does not allow store-specific Custom Option labels - MAGETWO-85207: Customer's order grid is not displaying - MAGETWO-86657: Import existing customer with only three columns will override customer group_id and store_id - MAGETWO-86154: Wrong page cached for logged in user - MAGETWO-83293: Inefficient SQL query on applying filter on sales order grid - MAGETWO-83343: Customer shopping cart not accessible in admin order - MAGETWO-85708: Zoom the image can't be closed by iPhone with Safari browser
Fixed issues: - MAGETWO-81802: Magento 2.2.0rc23: Customer Grid Indexer not working magento#10838 - MAGETWO-84448: Product Import does not allow store-specific Custom Option labels - MAGETWO-85207: Customer's order grid is not displaying - MAGETWO-86657: Import existing customer with only three columns will override customer group_id and store_id - MAGETWO-86154: Wrong page cached for logged in user - MAGETWO-83293: Inefficient SQL query on applying filter on sales order grid - MAGETWO-83343: Customer shopping cart not accessible in admin order - MAGETWO-85708: Zoom the image can't be closed by iPhone with Safari browser MAGETWO-87132: Remove JsTestDriver from Magento codebase MAGETWO-84219: Creditmemo comment via REST api does not send creditmemo update email MAGETWO-84219: Creditmemo comment via REST api does not send creditmemo update email MAGETWO-86452: [Backport for 2.2.x] Update copyright year alignement array assignement For Your Eyes Only Remove whitespace at end of line FIX: out-of-stock options for configurable product visible on frontend as sellable Adapt \Magento\Analytics\Block\Adminhtml\System\Config\CollectionTimeLabel::render method to use current locale to render time zone label, as done in \Magento\Framework\Locale\TranslatedLists::getOptionTimezones Handle transparncy correctly for watermark The watermark functionality uses imagecopymerge for copying the watermark into the image, this function loses the alpha information. Therefor use imagecopy for 100% opacity and use imagefilter in other cases. Resolves: magento#10661 Fix handling of watermark with alpha for Imagick When adding a watermark that already has an alpha channel this was reset because the overal opacity was set for the image. Instead we should multiply the original alpha with the requested opacity Handle non true color images with GD2 Add integration test for watermark with alpha Added integration tests for handling alpha transparency in watermarks. Renamed the current test for watermarks as it only tests if the watermark is correctly places Fix issues with static tests Remove ui-state-active from siblings of the expanded menu item Previously when a menu item was expanded the class `ui-state-active` was not removed from the previous expanded menu item. This resulted in two (or more if you expanded more) menu items with this class. Clean region when select country :bug: add fallback for Product_links position attribute if position index was not set in API request :ok_hand: shortening variable name :bug: fix variable re-naming :ok_hand: drop multiple empty lines :ok_hand: closing parenthesis and the opening brace of a multi-line function on the same line :ok_hand: closing parenthesis and the opening brace of a multi-line function on the same line :ok_hand: reset protected variable naming :ok_hand: rename isPositionsSet function to isPositionSet to keep consistency Fix typo :ok_hand: apply code enhancement :ok_hand: apply code enhancement Add type hint
Just updated to Magento 2.2.3 CE and it's not fixed. Had to apply my patch to make the customer grid indexer work again. Fatal error: Uncaught Error: Call to undefined method Magento\Customer\Model\Indexer\Source::addAttributeToSelect() in /mnt/host/projects/clients/qualipet/src/www/vendor/magento/framework/Indexer/Handler/AttributeHandler.php:38 |
@jhruehl: I'm pretty sure the fix is scheduled for 2.2.4 (see my latest comment), 2.2.3 only fixes security issues, no other bug fixes as far as I can see. |
Here's the patch again for everyone, who still needs a fix, because they have a custom customer attribute, which is used in grid, in their store. |
@hostep Doesn't really matter, if the issue is flagged with 'fixed in 2.2.x'. If they flagged the issue to be fixed, but the fix isn't even given in an update afterwards, the flag is quite misleading, isn't it? Then they should use a 'fixed in 2.2.4' flag and given that, I wouldn't even have reported the error. Again. |
A Patch in the Core Files is not best idea. You can made a module with this patch. Yesterday, i made a moudle quickly, to fix this problem. You can find it on composer require vitd/m2_fixes. Do not forget do following:
You can modifying the module on your own wish or you can write an issue ticket on the repo page. I hope this will help any one :) |
Still broken in 2.2.3 Commerce. |
Yes!, I have downloaded and upgrade magento 2.2.2 to 2.2.3. but still issue is not fixed from core. |
I can confirm this issue has been fixed in Magento Open Source 2.2.4. |
In my case when i create a custom customer attribute and "Add to Column Options" to yes in magento2 EE. i got this error when i try reindex. Magento Team needs to taking care it. |
i have add this function |
Before updating the index you have to launch the following commands:
|
i already launch these commands. but no success |
m follow this but got an error . how can i resolve ? |
@hafizjee, the correct fix is this one: 7759827 If you use composer, you can follow this guide to install this as a patch on top of your installation: https://support.magento.com/hc/en-us/articles/360005484154-Create-a-patch-for-a-Magento-2-Composer-installation-from-a-GitHub-commit Or you can just upgrade to Magento 2.2.4 or higher where this fix is included. |
@hafizjee
The error code leaves no doubt of interpretation. The application does not find the required method, so either you copied the code to the wrong file or you did not completely delete the cache. |
work for me |
I'm experiencing this problem on my Magento 2.1.12 as well. Is there any fix for the Magento 2.1.* ? Because the fixes mentioned earlier are all applying for Magento 2.2+ |
The Customer Grid Indexer doesn't work, when reindexing via CLI.
Preconditions
local - Docker Container:
Steps to reproduce
Expected result
Actual result
The text was updated successfully, but these errors were encountered: