0

i am getting below error for magento 2.4 and it is working fine in magento 2.3

Magento\Framework\Exception\LocalizedException: The XML in file "/var/www/html/magento240/app/code/PPPL/PhonePe/etc/frontend/events.xml" is invalid: Element 'event': Missing child element(s). Expected is ( observer ). Line: 4 Verify the XML and try again. in /var/www/html/magento240/vendor/magento/framework/Config/Reader/Filesystem.php:156 Stack trace: #0 /var/www/html/magento240/vendor/magento/framework/Config/Reader/Filesystem.php(132)

Please find the code for /var/www/html/magento240/app/code/PPPL/PhonePe/etc/frontend/events.xml

<?xml version="1.0"?><config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"><event name="checkout_onepage_controller_success_action">
 <!-- Do nothing -->
 </event>
</config>
Savan Patel
2,4541 gold badge19 silver badges42 bronze badges
asked Oct 10, 2020 at 5:07

1 Answer 1

1

It seems you didn't added observer name inside <event> tag.

You must have to declare <observer> tag inside <event> tag like below..

<observer name="observer_name" instance="Namespace\Module\Observer\ObserverClass" />

Because it's required, You can check more details in below Schema file..

vendor/magento/framework/Event/etc/events.xsd

Hope this will help you!

answered Oct 10, 2020 at 5:26

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.