cancel
Showing results for 
Search instead for 
Did you mean: 

Module 'Magento_Integration': Running schema recurring...Invalid Document

Module 'Magento_Integration': Running schema recurring...Invalid Document

Hi everyone,

 

Just wondering if anyone can assist. I am running Magento 2.2.3, and I am trying to install a new module on the site. When I run magento setup:upgrade command, I am getting the following error:


Module 'Magento_Integration':
Running schema recurring...Invalid Document
Element 'resource': The attribute 'title' is required but missing.
Line: 6

 

Does anyone know what could be causing this? I have searched and managed to see other posts about this, but I am unable to locate the file with the missing title. I have also tried changing the title field to optional, but I am still not managing to get past this stage.


Can anyone assist at all?


Many thanks!

6 REPLIES 6

Re: Module 'Magento_Integration': Running schema recurring...Invalid Document

@adamgreen2404

 

1) It would help immensely if instead of 'Invalid Document' it told you which document was invalid.

2) The setup:upgrade process should probably do some pre-flight checks to make sure it can do the upgrade.

Anyway, if you're stuck trying to find a missing title in the dozens of acl.xml files, but need to get a site back online quick, the quick workaround is to make the title attribute optional instead of required.

Edit vendor/magento/framework/Acl/etc/acl_merged.xsd

Find the line

<xs:attribute name="title" type="typeTitle" use="required" />

replace with

<xs:attribute name="title" type="typeTitle" use="optional" />

re-run magento setup:upgrade

You'll still need to find the plugin with the missing title at some point.

 

 

Find xml with help of below shared code:

 

To find the file with the missing attribute you can modify the following file

vendor/magento/framework/Config/Reader/Filesystem.php

add following code

foreach($configMerger->getDom()->getElementsByTagName('resource') as $element ){
    if (!$element->hasAttribute('title')) {        var_dump($configMerger->getDom()->saveXML($element));
    }
}

to the method

protected function _readFiles($fileList)

so it should look like

protected function _readFiles($fileList)
{
    /** @var \Magento\Framework\Config\Dom $configMerger */    $configMerger = null;
    foreach ($fileList as $key => $content) {
        try {
            if (!$configMerger) {                $configMerger = $this->_createConfigMerger($this->_domDocumentClass, $content);
            } else {                $configMerger->merge($content);
            }
        } catch (\Magento\Framework\Config\Dom\ValidationException $e) {
            throw new \Magento\Framework\Exception\LocalizedException(
                new \Magento\Framework\Phrase("Invalid XML in file %1:\n%2", [$key, $e->getMessage()])
            );
        }
    }
    if ($this->validationState->isValidationRequired()) {        $errors = [];
        if ($configMerger && !$configMerger->validate($this->_schemaFile, $errors)) {
            foreach($configMerger->getDom()->getElementsByTagName('resource') as $element ){
                if (!$element->hasAttribute('title')) {                    var_dump($configMerger->getDom()->saveXML($element));
                }
            }            $message = "Invalid Document \n";
            throw new \Magento\Framework\Exception\LocalizedException(
                new \Magento\Framework\Phrase($message . implode("\n", $errors))
            );
        }
    }    $output = [];
    if ($configMerger) {        $output = $this->_converter->convert($configMerger->getDom());
    }
    return $output;
}

Now you will be able to see a dump of the wrong XML element.

Manish Mittal
https://www.manishmittal.com/

Re: Module 'Magento_Integration': Running schema recurring...Invalid Document

Hi there,

Thanks a lot for the reply. I did see a post about this previously and I did try doing both of these methods, but still not working.

For the 2nd point, do you know where the dump of the incorrect xml element will be stored at all?

Thanks a lot,

Adam

Re: Module 'Magento_Integration': Running schema recurring...Invalid Document

@adamgreen2404

 

After modification in Filesystem.php file when you will run again php bin/magento setup:upgrade command you will find dumps and file path where you have to do changes.

 

CLI output:

/opt/lampp/htdocs/extensions/vendor/magento/framework/Config/Reader/Filesystem.php:164:
string(301) "<resource id="Magento_Cms:Smiley Tongueage" translate="title" sortOrder="10">
<resource id="Magento_Cms::save" translate="title" sortOrder="10"/>
<resource id="Magento_Cms:Smiley Tongueage_delete" translate="title" sortOrder="20"/>
</resource>"
/opt/lampp/htdocs/extensions/vendor/magento/framework/Config/Reader/Filesystem.php:164:
string(67) "<resource id="Magento_Cms::save" translate="title" sortOrder="10"/>"
/opt/lampp/htdocs/extensions/vendor/magento/framework/Config/Reader/Filesystem.php:164:
string(74) "<resource id="Magento_Cms:Smiley Tongueage_delete" translate="title" sortOrder="20"/>"
Invalid Document
Element 'resource': The attribute 'title' is required but missing.
Line: 14

Element 'resource': The attribute 'title' is required but missing.
Line: 15

Element 'resource': The attribute 'title' is required but missing.
Line: 16

 

Please find attached image for your reference:

 

Screenshot from 2018-10-22 18-54-55.png  1366×768 .png

Manish Mittal
https://www.manishmittal.com/

Re: Module 'Magento_Integration': Running schema recurring...Invalid Document

 Hi Manish,


Thanks a lot for your detailed reply. I do really appreciate your help. I have tried again with this, but I am still getting the same output after editing the filesystem.php file. Please see attached. Am I missing something here at all?

 

Thanks again.


Kind Regards,


Adammagentoerror.jpg

Re: Module 'Magento_Integration': Running schema recurring...Invalid Document

@adamgreen2404

 

That will be not possible, provide me code/ ssh details I will check. Do send me DM in inbox. Thanks

Manish Mittal
https://www.manishmittal.com/

Re: Module 'Magento_Integration': Running schema recurring...Invalid Document

Hello @adamgreen2404,

 

you have a <resource>-tag in any etc/acl.xml-file with a missing title-attribute. Usually this would throw the issue that you could not create or edit a new role. I'm guessing that they created an extra check in 2.2 to detect this more earlier.

Better check the acl.xml-files of your own custom extensions and/or those of 3rd party extensions. Please note: the title-attribute is only required for new <resource>-nodes. So if your adding a new resource-node to an existing resource node (provided by another module) there is no need to add the title-attribute to those. For example:

<!-- provided by Magento_Backend, so they already have a title: -->
<resource id="Magento_Backend::stores">
    <resource id="Magento_Backend::stores_settings">
        <!-- provided by Magento_Config: -->
        <resource id="Magento_Config::config">
            <!-- New resource! Title is required: -->
            <resource id="Vendor_Module::config_general" title="Something" translate="title"/> 
        </resource>
    </resource>
</resource>

--
If my answer is useful, please Accept as Solution & give Kudos