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.5k stars 9.31k forks source link

Rss Category not working #33116

Closed hryvinskyi closed 3 years ago

hryvinskyi commented 3 years ago

Preconditions (*)

  1. Magento 2.4.2-p1
  2. PHP 7.4.15

Steps to reproduce (*)

  1. Enable standard Rss Feed module.
  2. Enable Rss Feed for Top Level Category image
  3. Go to category page -> click on Subscribe to RSS Feed link image

Expected result (*)

  1. List of products: image

Actual result (*)

  1. Empty product list: image

What i found (*)

If i comment line ->addAttributeToSort('updated_at', 'desc') in file vendor/magento/module-catalog/Model/Rss/Category.php

image

list of products will appear

m2-assistant[bot] commented 3 years ago

Hi @hryvinskyi. 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-Echo. 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-Echo commented 3 years ago

Hi @hryvinskyi

We are not able to re-produce the issue with the given steps. In our case Rss feeds is showing the products without commenting the code.

Screenshot 2021-06-02 at 5 23 23 PM Screenshot 2021-06-02 at 5 23 36 PM

Request you to kindly test this issue on lates branch i.e. 2.4-develop or provide us more input so that we can reproduce the same on our system.

Thanks

engcom-Echo commented 3 years ago

Hi @hryvinskyi ,

We are closing this issue , as there has been not much update on it. If you are still getting this issue please comment.

Thanks

Djohn12 commented 11 months ago

Hi there,

Reproducing this issue on 2.4.6-p3 enterprise instance using magento product sample data.

  1. Enable standard Rss Feed module (Store > Configurations > Catalog > Rss Feeds > Rss Config > Enable Rss : Enable)
  2. Enable Rss Feed for Top Level Category (Store > Configurations > Catalog > Rss Feeds > Catalog > Top Level Category : Enable)
  3. Go to url store_url/rss/feed/index/type/category/cid/2/
  1. List of products
  2. No error
  1. Empty product list
  2. Error found in var/log/debug.log

Here is the complete error stack trace

==> var/log/debug.log <==
[2023-11-02T09:04:59.196588+00:00] main.CRITICAL: OpenSearch\Common\Exceptions\BadRequest400Exception: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [updated_at] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_1_v13","node":"PjkroXHHQGygiCLM3M6jsQ","reason":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [updated_at] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}],"caused_by":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [updated_at] in order to load field data by uninverting the inverted index. Note that this can use significant memory.","caused_by":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [updated_at] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}},"status":400} in /magento_code/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php:661
Stack trace:
#0 /magento_code/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php(328): OpenSearch\Connections\Connection->process4xxError(Array, Array, Array)
#1 /magento_code/vendor/react/promise/src/FulfilledPromise.php(28): OpenSearch\Connections\Connection->OpenSearch\Connections\{closure}(Array)
#2 /magento_code/vendor/ezimuel/ringphp/src/Future/CompletedFutureValue.php(65): React\Promise\FulfilledPromise->then(Object(Closure), NULL, NULL)
#3 /magento_code/vendor/ezimuel/ringphp/src/Core.php(341): GuzzleHttp\Ring\Future\CompletedFutureValue->then(Object(Closure), NULL, NULL)
#4 /magento_code/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php(340): GuzzleHttp\Ring\Core::proxy(Object(GuzzleHttp\Ring\Future\CompletedFutureArray), Object(Closure))
#5 /magento_code/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php(238): OpenSearch\Connections\Connection->OpenSearch\Connections\{closure}(Array, Object(OpenSearch\Connections\Connection), Object(OpenSearch\Transport), Array)
#6 /magento_code/vendor/opensearch-project/opensearch-php/src/OpenSearch/Transport.php(113): OpenSearch\Connections\Connection->performRequest('POST', '/magento2_produ...', Array, '{"from":0,"size...', Array, Object(OpenSearch\Transport))
#7 /magento_code/vendor/opensearch-project/opensearch-php/src/OpenSearch/Client.php(1389): OpenSearch\Transport->performRequest('POST', '/magento2_produ...', Array, Array, Array)
#8 /magento_code/vendor/opensearch-project/opensearch-php/src/OpenSearch/Client.php(1045): OpenSearch\Client->performRequest(Object(OpenSearch\Endpoints\Search))
#9 /magento_code/vendor/magento/module-open-search/Model/OpenSearch.php(51): OpenSearch\Client->search(Array)
#10 /magento_code/vendor/magento/module-open-search/SearchAdapter/Adapter.php(111): Magento\OpenSearch\Model\OpenSearch->query(Array)
#11 /magento_code/vendor/magento/module-search/Model/SearchEngine.php(42): Magento\OpenSearch\SearchAdapter\Adapter->query(Object(Magento\Framework\Search\Request))
#12 /magento_code/vendor/magento/framework/Search/Search.php(85): Magento\Search\Model\SearchEngine->search(Object(Magento\Framework\Search\Request))
#13 /magento_code/vendor/magento/module-catalog-search/Model/ResourceModel/Fulltext/Collection.php(464): Magento\Framework\Search\Search->search(Object(Magento\Framework\Api\Search\SearchCriteria))
#14 /magento_code/vendor/magento/framework/Data/Collection/AbstractDb.php(343): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection->_renderFiltersBefore()
#15 /magento_code/vendor/magento/module-catalog-search/Model/ResourceModel/Fulltext/Collection.php(582): Magento\Framework\Data\Collection\AbstractDb->_renderFilters()
#16 /magento_code/vendor/magento/module-eav/Model/Entity/Collection/AbstractCollection.php(929): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection->_renderFilters()
#17 /magento_code/vendor/magento/module-catalog/Model/ResourceModel/Product/Collection.php(801): Magento\Eav\Model\Entity\Collection\AbstractCollection->load(false, false)
#18 /magento_code/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Catalog\Model\ResourceModel\Product\Collection->load(false, false)
#19 /magento_code/vendor/magento/framework/Interception/Interceptor.php(138): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\Interceptor->___callParent('load', Array)
#20 /magento_code/vendor/magento/framework/Interception/Interceptor.php(153): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\Interceptor->Magento\Framework\Interception\{closure}()
#21 /magento_code/generated/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection/Interceptor.php(257): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\Interceptor->___callPlugins('load', Array, Array)
#22 /magento_code/vendor/magento/framework/Data/Collection.php(840): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\Interceptor->load()
#23 /magento_code/generated/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection/Interceptor.php(1292): Magento\Framework\Data\Collection->getIterator()
#24 /magento_code/vendor/magento/module-catalog/Block/Rss/Category.php(128): Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection\Interceptor->getIterator()
#25 /magento_code/vendor/magento/module-rss/Model/Rss.php(83): Magento\Catalog\Block\Rss\Category->getRssData()
#26 /magento_code/vendor/magento/module-rss/Model/Rss.php(114): Magento\Rss\Model\Rss->getFeeds()
#27 /magento_code/vendor/magento/module-rss/Controller/Feed/Index.php(49): Magento\Rss\Model\Rss->createRssXml()
#28 /magento_code/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Rss\Controller\Feed\Index->execute()
#29 /magento_code/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Rss\Controller\Feed\Index\Interceptor->___callParent('execute', Array)
#30 /magento_code/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Rss\Controller\Feed\Index\Interceptor->Magento\Framework\Interception\{closure}()
#31 /magento_code/generated/code/Magento/Rss/Controller/Feed/Index/Interceptor.php(23): Magento\Rss\Controller\Feed\Index\Interceptor->___callPlugins('execute', Array, Array)
#32 /magento_code/vendor/magento/framework/App/Action/Action.php(111): Magento\Rss\Controller\Feed\Index\Interceptor->execute()
#33 /magento_code/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#34 /magento_code/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Rss\Controller\Feed\Index\Interceptor->___callParent('dispatch', Array)
#35 /magento_code/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Rss\Controller\Feed\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#36 /magento_code/generated/code/Magento/Rss/Controller/Feed/Index/Interceptor.php(32): Magento\Rss\Controller\Feed\Index\Interceptor->___callPlugins('dispatch', Array, Array)
#37 /magento_code/vendor/magento/framework/App/FrontController.php(245): Magento\Rss\Controller\Feed\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#38 /magento_code/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse(Object(Magento\Rss\Controller\Feed\Index\Interceptor), Object(Magento\Framework\App\Request\Http))
#39 /magento_code/vendor/magento/framework/App/FrontController.php(147): Magento\Framework\App\FrontController->processRequest(Object(Magento\Framework\App\Request\Http), Object(Magento\Rss\Controller\Feed\Index\Interceptor))
#40 /magento_code/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#41 /magento_code/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#42 /magento_code/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(99): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#43 /magento_code/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#44 /magento_code/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(71): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#45 /magento_code/vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#46 /magento_code/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#47 /magento_code/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, NULL)
#48 /magento_code/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#49 /magento_code/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()
#50 /magento_code/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
#51 /magento_code/pub/index.php(30): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#52 {main} {"exception":"[object] (OpenSearch\\Common\\Exceptions\\BadRequest400Exception(code: 400): {\"error\":{\"root_cause\":[{\"type\":\"illegal_argument_exception\",\"reason\":\"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [updated_at] in order to load field data by uninverting the inverted index. Note that this can use significant memory.\"}],\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"query\",\"grouped\":true,\"failed_shards\":[{\"shard\":0,\"index\":\"magento2_product_1_v13\",\"node\":\"PjkroXHHQGygiCLM3M6jsQ\",\"reason\":{\"type\":\"illegal_argument_exception\",\"reason\":\"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [updated_at] in order to load field data by uninverting the inverted index. Note that this can use significant memory.\"}}],\"caused_by\":{\"type\":\"illegal_argument_exception\",\"reason\":\"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [updated_at] in order to load field data by uninverting the inverted index. Note that this can use significant memory.\",\"caused_by\":{\"type\":\"illegal_argument_exception\",\"reason\":\"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [updated_at] in order to load field data by uninverting the inverted index. Note that this can use significant memory.\"}}},\"status\":400} at /magento_code/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php:661)"} []

I confirm commenting vendor/magento/module-catalog/Model/Rss/Category.php line 71 does fix the issue. It seems the default updated_at sorting needs to be made compatible with opensearch.

Hope this helps.

Djohn12 commented 10 months ago

If anyone is looking for a fix, there is an official adobe quality patch on the subject available at https://experienceleague.adobe.com/docs/commerce-knowledge-base/kb/support-tools/patches/v1-1-28/acsd-48866-error-when-requesting-rss-feed-for-categories.html