Skip to content

Not possible to use Email notification channel. Exception and blank page #179

@sdzhepa

Description

@sdzhepa

Preconditions (*)

  1. Install Magento using security-package
mkdir magento2
git clone -b 2.4-develop --single-branch https://github.com/magento/magento2.git magento2
git clone -b 1.0-develop --single-branch https://github.com/magento/security-package.git magento2/ext/magento/security-package
cd magento2
composer config minimum-stability dev
composer config repositories.ext path ./ext/*/*/*
composer require magento/security-package

Steps to reproduce (*)

Create notification Channel for Email

  1. Go to SYSTEM > Notifier > Manage Channels
  2. Select "Email" for "New channel" button
  3. Fill with any valid data e.g.
  1. Click "Save Channel"

Creat template for notification
5. Go to SYSTEM > Notifier > Manage Templates
6. Click "New Template"
7. Fill the form with next data:

  • Template Name: Email Template
  • Identifier: emailTemplate
  • Adapter Code: "Email"
  1. Select from drop-down "Copy from system template:"
  • Default Event Template
  1. Click "Copy" button
  2. Click "Save Template" button

Create new Event Rule
11. Go to SYSTEM > Notifier > Manage Templates
12. Click "New Rule" button
13. Fill the form with next data

  • Name: Email Event Rule
  • Events: 'admin_system_config_save'
  • Tempete: Email Template
  • Channel: Email Channel
  1. Click "Save Rule" button
    Enable notification in Configuration
  2. Go to STORES > Configuration > NOTIFIER FRAMEWORK > Notifications
  3. Set next values
  • General: Enable = YES
  • Security notifications on events: Admin configuration changed = Email Channel
  1. Click "Save Config"

Expected result (*)

  • The configuration is successfully saved

Actual result (*)

  1. Blank page with title "n error has happened during application run. See exception log for details."
  2. Error in system.log
[2020-04-01 21:27:28] report.CRITICAL: Error: Cannot instantiate interface Magento\Framework\Mail\MailMessageInterface in /app/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121
Stack trace:
#0 /app/vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array)
#1 /app/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Compiled->create('Magento\\Framewo...', Array)
#2 /app/generated/code/Magento/Framework/Mail/MailMessageInterfaceFactory.php(43): Magento\Framework\ObjectManager\ObjectManager->create('\\Magento\\Framew...', Array)
#3 /app/ext/magento/security-package/NotifierEmailAdapter/Model/AdapterEngine/Email.php(75): Magento\Framework\Mail\MailMessageInterfaceFactory->create()
#4 /app/ext/magento/security-package/NotifierApi/Model/Adapter.php(81): Magento\NotifierEmailAdapter\Model\AdapterEngine\Email->execute('<strong>Magento...', Array, Array)
#5 /app/ext/magento/security-package/Notifier/Model/SendMessage.php(75): Magento\NotifierApi\Model\Adapter->sendMessage('<strong>Magento...', Array, Array)
#6 /app/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Notifier\Model\SendMessage->execute('email_test', '<strong>Magento...', Array)
#7 /app/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Notifier\Model\SendMessage\Interceptor->___callParent('execute', Array)
#8 /app/ext/magento/security-package/NotifierAsync/Plugin/SendMessageAsynchronously.php(87): Magento\Notifier\Model\SendMessage\Interceptor->Magento\Framework\Interception\{closure}('email_test', '<strong>Magento...', Array)
#9 /app/vendor/magento/framework/Interception/Interceptor.php(135): Magento\NotifierAsync\Plugin\SendMessageAsynchronously->aroundExecute(Object(Magento\Notifier\Model\SendMessage\Interceptor), Object(Closure), 'email_test', '<strong>Magento...', Array)
#10 /app/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Notifier\Model\SendMessage\Interceptor->Magento\Framework\Interception\{closure}('email_test', '<strong>Magento...', Array)
#11 /app/generated/code/Magento/Notifier/Model/SendMessage/Interceptor.php(26): Magento\Notifier\Model\SendMessage\Interceptor->___callPlugins('execute', Array, NULL)
#12 /app/ext/magento/security-package/NotifierTemplate/Model/SendMessage.php(48): Magento\Notifier\Model\SendMessage\Interceptor->execute('email_test', '<strong>Magento...', Array)
#13 /app/ext/magento/security-package/NotifierSecurity/Model/NotifyByEvent/NotifyByConfig.php(63): Magento\NotifierTemplate\Model\SendMessage->execute('email_test', 'security_admin_...', Array)
#14 /app/ext/magento/security-package/NotifierSecurity/Model/NotifyByEvent.php(43): Magento\NotifierSecurity\Model\NotifyByEvent\NotifyByConfig->execute('controller_acti...', Array)
#15 /app/ext/magento/security-package/NotifierSecurity/Observer/OnEvent.php(35): Magento\NotifierSecurity\Model\NotifyByEvent->execute('controller_acti...', Array)
#16 /app/vendor/magento/framework/Event/Invoker/InvokerDefault.php(88): Magento\NotifierSecurity\Observer\OnEvent->execute(Object(Magento\Framework\Event\Observer))
#17 /app/vendor/magento/framework/Event/Invoker/InvokerDefault.php(74): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\NotifierSecurity\Observer\OnEvent), Object(Magento\Framework\Event\Observer))
#18 /app/vendor/magento/module-staging/Model/Event/Manager.php(97): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer))
#19 /app/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Staging\Model\Event\Manager->dispatch('controller_acti...', Array)
#20 /app/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Staging\Model\Event\Manager\Interceptor->___callParent('dispatch', Array)
#21 /app/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Staging\Model\Event\Manager\Interceptor->Magento\Framework\Interception\{closure}('controller_acti...', Array)
#22 /app/generated/code/Magento/Staging/Model/Event/Manager/Interceptor.php(26): Magento\Staging\Model\Event\Manager\Interceptor->___callPlugins('dispatch', Array, Array)
#23 /app/generated/code/Magento/Staging/Model/Event/Manager/Proxy.php(95): Magento\Staging\Model\Event\Manager\Interceptor->dispatch('controller_acti...', Array)
#24 /app/vendor/magento/framework/App/Action/Plugin/EventDispatchPlugin.php(115): Magento\Staging\Model\Event\Manager\Proxy->dispatch('controller_acti...', Array)
#25 /app/vendor/magento/framework/App/Action/Plugin/EventDispatchPlugin.php(60): Magento\Framework\App\Action\Plugin\EventDispatchPlugin->dispatchPreDispatchEvents(Object(Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor))
#26 /app/vendor/magento/framework/Interception/Interceptor.php(121): Magento\Framework\App\Action\Plugin\EventDispatchPlugin->beforeExecute(Object(Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor))
#27 /app/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->Magento\Framework\Interception\{closure}()
#28 /app/generated/code/Magento/Config/Controller/Adminhtml/System/Config/Save/Interceptor.php(26): Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->___callPlugins('execute', Array, Array)
#29 /app/vendor/magento/framework/App/Action/Action.php(109): Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->execute()
#30 /app/vendor/magento/module-backend/App/AbstractAction.php(150): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#31 /app/vendor/magento/module-config/Controller/Adminhtml/System/AbstractConfig.php(69): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#32 /app/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Config\Controller\Adminhtml\System\AbstractConfig->dispatch(Object(Magento\Framework\App\Request\Http))
#33 /app/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->___callParent('dispatch', Array)
#34 /app/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#35 /app/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#36 /app/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#37 /app/generated/code/Magento/Config/Controller/Adminhtml/System/Config/Save/Interceptor.php(39): Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->___callPlugins('dispatch', Array, Array)
#38 /app/vendor/magento/framework/App/FrontController.php(162): Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#39 /app/vendor/magento/framework/App/FrontController.php(99): Magento\Framework\App\FrontController->processRequest(Object(Magento\Framework\App\Request\Http), Object(Magento\Config\Controller\Adminhtml\System\Config\Save\Interceptor))
#40 /app/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#41 /app/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#42 /app/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#43 /app/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#44 /app/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#45 /app/vendor/magento/framework/App/Bootstrap.php(260): Magento\Framework\App\Http->launch()
#46 /app/pub/index.php(40): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#47 {main} [] []

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions