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.3k forks source link

Magento Responds with 500 on certain pages if you include the "Accept: text/html" header #38907

Open gwharton opened 3 months ago

gwharton commented 3 months ago

Preconditions and environment

Magento v2.4.7-p1

Steps to reproduce

Deploy Vanilla Magento 2.4.7-p1 curl -I --header "Accept: text/html" https://testdomain.com/checkout

Expected result

HTTP/2 200

Actual result

HTTP/2 500

{{
[2024-07-08T07:46:09.945655+00:00] main.CRITICAL: Magento\Framework\Webapi\Exception: Server cannot match any of the given Accept HTTP header media type(s) from the request: "text/html" with media types from the config of response renderer. in /home/ubuntu/vanilla/vendor/magento/framework/Webapi/Rest/Response/RendererFactory.php:84
Stack trace:
# 0 /home/ubuntu/vanilla/vendor/magento/framework/Webapi/Rest/Response/RendererFactory.php(54): Magento\Framework\Webapi\Rest\Response\RendererFactory->_getRendererClass()
# 1 /home/ubuntu/vanilla/vendor/magento/framework/Webapi/Rest/Response.php(45): Magento\Framework\Webapi\Rest\Response\RendererFactory->get()
# 2 /home/ubuntu/vanilla/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(121): Magento\Framework\Webapi\Rest\Response->__construct(Object(Magento\Framework\Webapi\Rest\Response\RendererFactory), Object(Magento\Framework\Webapi\ErrorProcessor), Object(Magento\Framework\App\State\Interceptor))
# 3 /home/ubuntu/vanilla/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framework\\Webapi\\Rest
Response', Array)
# 4 /home/ubuntu/vanilla/vendor/magento/framework/ObjectManager/ObjectManager.php(73): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framework\\Webapi\\Rest
Response')
# 5 /home/ubuntu/vanilla/vendor/magento/module-quote/Model/QuoteValidator.php(72): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Framework\\Webapi\\Rest
Response')
# 6 /home/ubuntu/vanilla/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(121): Magento\Quote\Model\QuoteValidator->__construct(NULL, NULL, NULL, NULL)
# 7 /home/ubuntu/vanilla/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Quote\\Model
QuoteValidator', Array)
# 8 /home/ubuntu/vanilla/vendor/magento/framework/ObjectManager/ObjectManager.php(73): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Quote\\Model
QuoteValidator')
# 9 /home/ubuntu/vanilla/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(170): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Quote\\Model
QuoteValidator')
# 10 /home/ubuntu/vanilla/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(276): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Quote\\Model
QuoteValidator', NULL, 'quoteValidator', 'Magento\\Quote\\Model
Quote')
# 11 /home/ubuntu/vanilla/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(239): Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument('Magento\\Quote\\Model
Quote', Array, Array)
# 12 /home/ubuntu/vanilla/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\\Quote\\Model
Quote', Array, Array)
# 13 /home/ubuntu/vanilla/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Quote\\Model
Quote', Array, Array)
# 14 /home/ubuntu/vanilla/vendor/magento/framework/ObjectManager/ObjectManager.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Quote\\Model
Quote', Array)
# 15 /home/ubuntu/vanilla/generated/code/Magento/Quote/Model/QuoteFactory.php(43): Magento\Framework\ObjectManager\ObjectManager->create('\\Magento\\Quote\\Model
Quote', Array)
# 16 /home/ubuntu/vanilla/vendor/magento/module-checkout/Model/Session.php(257): Magento\Quote\Model\QuoteFactory->create()
# 17 /home/ubuntu/vanilla/generated/code/Magento/Checkout/Model/Session/Interceptor.php(50): Magento\Checkout\Model\Session->getQuote()
# 18 /home/ubuntu/vanilla/vendor/magento/module-checkout/Controller/Onepage.php(153): Magento\Checkout\Model\Session\Interceptor->getQuote()
# 19 /home/ubuntu/vanilla/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Checkout\Controller\Onepage->dispatch(Object(Magento\Framework\App\Request\Http))
# 20 /home/ubuntu/vanilla/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Checkout\Controller\Index\Index\Interceptor->*_*callParent('dispatch', Array)
# 21 /home/ubuntu/vanilla/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Checkout\Controller\Index\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
# 22 /home/ubuntu/vanilla/generated/code/Magento/Checkout/Controller/Index/Index/Interceptor.php(32): Magento\Checkout\Controller\Index\Index\Interceptor->*_*callPlugins('dispatch', Array, Array)
# 23 /home/ubuntu/vanilla/vendor/magento/framework/App/FrontController.php(245): Magento\Checkout\Controller\Index\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
# 24 /home/ubuntu/vanilla/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse(Object(Magento\Checkout\Controller\Index\Index\Interceptor), Object(Magento\Framework\App\Request\Http))
# 25 /home/ubuntu/vanilla/vendor/magento/framework/App/FrontController.php(146): Magento\Framework\App\FrontController->processRequest(Object(Magento\Framework\App\Request\Http), Object(Magento\Checkout\Controller\Index\Index\Interceptor))
# 26 /home/ubuntu/vanilla/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
# 27 /home/ubuntu/vanilla/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->*_*callParent('dispatch', Array)
# 28 /home/ubuntu/vanilla/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))
# 29 /home/ubuntu/vanilla/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))
# 30 /home/ubuntu/vanilla/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(76): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
# 31 /home/ubuntu/vanilla/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))
# 32 /home/ubuntu/vanilla/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
# 33 /home/ubuntu/vanilla/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->*_*callPlugins('dispatch', Array, NULL)
# 34 /home/ubuntu/vanilla/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
# 35 /home/ubuntu/vanilla/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Http->launch()
# 36 /home/ubuntu/vanilla/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\Http\Interceptor->*_*callParent('launch', Array)
# 37 /home/ubuntu/vanilla/vendor/magento/module-application-performance-monitor/Plugin/ApplicationPerformanceMonitor.php(38): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
# 38 /home/ubuntu/vanilla/vendor/magento/framework/Interception/Interceptor.php(135): Magento\ApplicationPerformanceMonitor\Plugin\ApplicationPerformanceMonitor->aroundLaunch(Object(Magento\Framework\App\Http\Interceptor), Object(Closure))
# 39 /home/ubuntu/vanilla/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
# 40 /home/ubuntu/vanilla/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http\Interceptor->*_*callPlugins('launch', Array, NULL)
# 41 /home/ubuntu/vanilla/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
# 42 /home/ubuntu/vanilla/pub/vanilla/index.php(30): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
# 43 \{main} \{"report_id":"735cd118ab8b1cde04498e8637e1e6e154215027b4732c6ee117ec7528d9209f","exception":"[object] (Magento\\Framework\\Webapi\\Exception(code: 0): Server cannot match any of the given Accept HTTP header media type(s) from the request: \"text/html\" with media types from the config of response renderer. at /home/ubuntu/vanilla/vendor/magento/framework/Webapi/Rest/Response/RendererFactory.php:84)"} []
}}

Additional information

Any page that has an ultimate DI dependency on the class Magento\Framework\Webapi\Rest\Response will return a 500 if the Accept header is not one of {*}/{*}, application/json or application/xml.

This is because the constructor of the Magento\Framework\Webapi\Rest\Response class loads all WebApi renderers and checks the Accept header of the current call, regardless of whether the actual web request was a Webapi request or not.

The DI dependency tree on Magento\Framework\Webapi\Rest\Response includes the class Magento\Quote\Model\QuoteValidator which ofcourse means that any calls to the checkout on a vanilla install with the header Accept: text/html will fail.

I suspect there are other dependency paths that result in the instantiation of a "Magento\Framework\Webapi\Rest\Response"\ object in the constructor that are used for regular Web requests, and these too will fail if the "Accept: text/html" header is set.

Release note

Magento now correctly handles regular web requests when the HTTP Accept header is set to "text/html". Previously, an exception was generated if the webpage had a dependency link to the "Magento\Framework\Webapi\Rest\Response" class.

Triage and priority

m2-assistant[bot] commented 3 months ago

Hi @gwharton. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

gwharton commented 3 months ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 3 months ago

Hi @gwharton. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 months ago

Hi @gwharton, here is your Magento Instance: https://3f0c00b51f03fb401baba059c392ecad.instances-prod.magento-community.engineering Admin access: https://3f0c00b51f03fb401baba059c392ecad.instances-prod.magento-community.engineering/admin_cfb3 Login: 00c0312d Password: 692da97476b5

gwharton commented 3 months ago
ubuntu@megumi:~$ curl -I -u 00c0312d:692da97476b5 --header "Accept: text/html" https://3f0c00b51f03fb401baba059c392ecad.instances-prod.magento-community.engineering/checkout
HTTP/2 500
date: Mon, 08 Jul 2024 08:31:06 GMT
content-type: text/html; charset=UTF-8
server: Apache/2.4.59 (Ubuntu)
x-powered-by: PHP/8.2.20
pragma: no-cache
cache-control: max-age=0, must-revalidate, no-cache, no-store
expires: Sat, 08 Jul 2023 08:31:06 GMT
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
set-cookie: PHPSESSID=b009b5996669de3adf04861cab85049a; expires=Mon, 08 Jul 2024 09:31:06 GMT; Max-Age=3600; path=/; domain=3f0c00b51f03fb401baba059c392ecad.instances-prod.magento-community.engineering; HttpOnly; SameSite=Lax
m2-assistant[bot] commented 3 months ago

Hi @engcom-Bravo. 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-Bravo commented 2 months ago

Hi @gwharton,

Thanks for your reporting and collaboration.

We have verified the issue in Latest 2.4-develop instance and the issue is reproducible.Kindly refer the screenshot.

Screenshot 2024-07-10 at 11 35 05
[2024-07-10T05:59:17.129413+00:00] main.CRITICAL: Magento\Framework\Webapi\Exception: Server cannot match any of the given Accept HTTP header media type(s) from the request: "text/html" with media types from the config of response renderer. in /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/Webapi/Rest/Response/RendererFactory.php:84
Stack trace:
#0 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/Webapi/Rest/Response/RendererFactory.php(54): Magento\Framework\Webapi\Rest\Response\RendererFactory->_getRendererClass()
#1 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/Webapi/Rest/Response.php(45): Magento\Framework\Webapi\Rest\Response\RendererFactory->get()
#2 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/ObjectManager/Factory/AbstractFactory.php(121): Magento\Framework\Webapi\Rest\Response->__construct(Object(Magento\Framework\Webapi\Rest\Response\RendererFactory), Object(Magento\Framework\Webapi\ErrorProcessor), Object(Magento\Framework\App\State\Interceptor))
#3 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array)
#4 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/ObjectManager/ObjectManager.php(73): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...')
#5 /usr/local/var/www/magentok/magento2/app/code/Magento/Quote/Model/QuoteValidator.php(72): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Framewo...')
#6 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/ObjectManager/Factory/AbstractFactory.php(121): Magento\Quote\Model\QuoteValidator->__construct(NULL, NULL, NULL, NULL)
#7 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Quote\\M...', Array)
#8 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/ObjectManager/ObjectManager.php(73): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Quote\\M...')
#9 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/ObjectManager/Factory/AbstractFactory.php(170): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Quote\\M...')
#10 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/ObjectManager/Factory/AbstractFactory.php(276): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Quote\\M...', NULL, 'quoteValidator', 'Magento\\Quote\\M...')
#11 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/ObjectManager/Factory/AbstractFactory.php(239): Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument('Magento\\Quote\\M...', Array, Array)
#12 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\\Quote\\M...', Array, Array)
#13 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Quote\\M...', Array, Array)
#14 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/ObjectManager/ObjectManager.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Quote\\M...', Array)
#15 /usr/local/var/www/magentok/magento2/generated/code/Magento/Quote/Model/QuoteFactory.php(43): Magento\Framework\ObjectManager\ObjectManager->create('\\Magento\\Quote\\...', Array)
#16 /usr/local/var/www/magentok/magento2/app/code/Magento/Checkout/Model/Session.php(257): Magento\Quote\Model\QuoteFactory->create()
#17 /usr/local/var/www/magentok/magento2/generated/code/Magento/Checkout/Model/Session/Interceptor.php(50): Magento\Checkout\Model\Session->getQuote()
#18 /usr/local/var/www/magentok/magento2/app/code/Magento/Checkout/Controller/Onepage.php(153): Magento\Checkout\Model\Session\Interceptor->getQuote()
#19 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(58): Magento\Checkout\Controller\Onepage->dispatch(Object(Magento\Framework\App\Request\Http))
#20 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(138): Magento\Checkout\Controller\Index\Index\Interceptor->___callParent('dispatch', Array)
#21 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(153): Magento\Checkout\Controller\Index\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#22 /usr/local/var/www/magentok/magento2/generated/code/Magento/Checkout/Controller/Index/Index/Interceptor.php(32): Magento\Checkout\Controller\Index\Index\Interceptor->___callPlugins('dispatch', Array, Array)
#23 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/App/FrontController.php(245): Magento\Checkout\Controller\Index\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#24 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse(Object(Magento\Checkout\Controller\Index\Index\Interceptor), Object(Magento\Framework\App\Request\Http))
#25 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/App/FrontController.php(146): Magento\Framework\App\FrontController->processRequest(Object(Magento\Framework\App\Request\Http), Object(Magento\Checkout\Controller\Index\Index\Interceptor))
#26 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#27 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#28 /usr/local/var/www/magentok/magento2/app/code/Magento/Store/App/FrontController/Plugin/RequestPreprocessor.php(99): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#29 /usr/local/var/www/magentok/magento2/lib/internal/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))
#30 /usr/local/var/www/magentok/magento2/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php(76): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#31 /usr/local/var/www/magentok/magento2/lib/internal/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))
#32 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#33 /usr/local/var/www/magentok/magento2/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, NULL)
#34 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#35 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(58): Magento\Framework\App\Http->launch()
#36 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(138): Magento\Framework\App\Http\Interceptor->___callParent('launch', Array)
#37 /usr/local/var/www/magentok/magento2/app/code/Magento/ApplicationPerformanceMonitor/Plugin/ApplicationPerformanceMonitor.php(38): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
#38 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(135): Magento\ApplicationPerformanceMonitor\Plugin\ApplicationPerformanceMonitor->aroundLaunch(Object(Magento\Framework\App\Http\Interceptor), Object(Closure))
#39 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(153): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
#40 /usr/local/var/www/magentok/magento2/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http\Interceptor->___callPlugins('launch', Array, NULL)
#41 /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
#42 /usr/local/var/www/magentok/magento2/pub/index.php(30): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#43 {main} {"report_id":"f571ac7b359a5fe2fc3b5bf6bbe248c817bfa08d56f186f33e2dc745ddc3daa3","exception":"[object] (Magento\\Framework\\Webapi\\Exception(code: 0): Server cannot match any of the given Accept HTTP header media type(s) from the request: \"text/html\" with media types from the config of response renderer. at /usr/local/var/www/magentok/magento2/lib/internal/Magento/Framework/Webapi/Rest/Response/RendererFactory.php:84)"} []

Hence Confirming the issue.

Thanks.

github-jira-sync-bot commented 2 months ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12386 is successfully created for this GitHub issue.

m2-assistant[bot] commented 2 months ago

:white_check_mark: Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

jorgb90 commented 2 months ago

This issue is spamming our logs :)

gwharton commented 2 months ago

Yep, yandex crawlers all run with accept text/html. That's how I noticed it in my logs.

meandor-ua commented 2 months ago

Issue is caused by this line. It seems REST specific response object with instance \Magento\Framework\Webapi\Rest\Response was injected into general model such as \Magento\Quote\Model\QuoteValidator. For me issue happens when object manager tries to create \Magento\NegotiableQuote\Model\Plugin\Checkout\Model\SessionPlugin on the very early stage of execution any page, but not only REST API related calls.

gwharton commented 2 months ago

Yeah, if you have the Stripe payment module installed, it also occurs on every page for a similar reason. They add a plugin to the main Front controller which causes it to trigger for every page.

willryan-stemcell commented 2 months ago

Is there any update on this issue?

kom93 commented 1 month ago

Here's a patch for logs spam, at least until the issue is fixed in the repo:

diff --git a/vendor/magento/module-quote/Model/QuoteValidator.php b/vendor/magento/module-quote/Model/QuoteValidator.php
--- a/vendor/magento/module-quote/Model/QuoteValidator.php  (revision 6aee74ca7b27e3d7904f5160017bab9568f9d60d)
+++ b/vendor/magento/module-quote/Model/QuoteValidator.php  (date 1723630766091)
@@ -14,7 +14,6 @@
 use Magento\Quote\Model\Quote as QuoteEntity;
 use Magento\Quote\Model\Quote\Validator\MinimumOrderAmount\ValidationMessage as OrderAmountValidationMessage;
 use Magento\Quote\Model\ValidationRules\QuoteValidationRuleInterface;
-use Magento\Framework\Webapi\Rest\Response as RestResponse;

 /**
  * Class to validate the quote
@@ -44,24 +43,17 @@
      */
     private $quoteValidationRule;

-    /**
-     * @var RestResponse
-     */
-    private $_response;
-
     /**
      * QuoteValidator constructor.
      *
      * @param AllowedCountries|null $allowedCountryReader
      * @param OrderAmountValidationMessage|null $minimumAmountMessage
      * @param QuoteValidationRuleInterface|null $quoteValidationRule
-     * @param RestResponse|null $response
      */
     public function __construct(
         AllowedCountries $allowedCountryReader = null,
         OrderAmountValidationMessage $minimumAmountMessage = null,
-        QuoteValidationRuleInterface $quoteValidationRule = null,
-        RestResponse $response = null
+        QuoteValidationRuleInterface $quoteValidationRule = null
     ) {
         $this->allowedCountryReader = $allowedCountryReader ?: ObjectManager::getInstance()
             ->get(AllowedCountries::class);
@@ -69,7 +61,6 @@
             ->get(OrderAmountValidationMessage::class);
         $this->quoteValidationRule = $quoteValidationRule ?: ObjectManager::getInstance()
             ->get(QuoteValidationRuleInterface::class);
-        $this->_response = $response ?: ObjectManager::getInstance()->get(RestResponse::class);
     }

     /**
@@ -115,7 +106,6 @@
                 $defaultMessage .= ' %1';
             }
             if ($defaultMessage) {
-                $this->_response->setHeader('errorRedirectAction', '#shipping');
                 throw new ValidatorException(__($defaultMessage, implode(' ', $messages)));
             }
         }
PaulWatt commented 1 month ago

Is this fixed in Magento v2.4.7-p2?

devchris79 commented 1 month ago

@PaulWatt No, we are seeing this in v2.4.7-p2.