Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento 2 blank page but not empty

I am developing a Magento 2.3 site which was working but has stopped. When I try to get a page up, I get a blank screen. Although it looks empty, it actually contains a little content:

  <!doctype html>
<html lang="en">
    <head >
                <meta charset="utf-8"/>
<meta name="description" content="Blah Blah"/>
<meta name="keywords" content="More blah blah"/>
<meta name="robots" content="INDEX,FOLLOW"/>
<title></title>
<link  rel="icon" type="image/x-icon" href="http://www.magento2.domain/pub/media/favicon/stores/1/3-ladies-bg.jpg" />
<link  rel="shortcut icon" type="image/x-icon" href="http://www.magento2.domain/pub/media/favicon/stores/1/3-ladies-bg.jpg" />
<link href='https://fonts.googleapis.com/css?family=Prosto+One' rel='stylesheet' type='text/css' />
<!--xxxabb2c66c7681e8f658-->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxx-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-131267613-1');
</script>            </head>
    <body data-container="body" data-mage-init='{"loaderAjax": {}, "loader": { "icon": "http://www.magento2.domain/pub/static/version1551796553/frontend/_view/en_GB/images/loader-2.gif"}}' class="cms-index-index page-layout-1column">
            </body>
</html>

If I look in the system log, I see the following errors:

[2019-04-30 21:24:48] main.INFO: Broken reference: the 'theme.active.editor' element cannot be added as child to 'after.body.start', because the latter doesn't exist [] []
[2019-04-30 21:24:48] main.INFO: Broken reference: the 'logger' element cannot be added as child to 'after.body.start', because the latter doesn't exist [] []

I've enabled error logging but I get nothing. Can anyone help?

Alternatively, can somebody point me to a good map (or similar) of how magento 2 builds a page so I can try and track down the error.

like image 725
PedroKTFC Avatar asked Apr 30 '19 21:04

PedroKTFC


2 Answers

I have tracked down the issue to a problem with pub/generated/metadata/global.php. Even regenerating it causes the same problem. If I delete the file everything seems to work ok. I confess to not understanding why!

I now avoid this by not running bin/magento setup:di:compile. I simply run php bin/magento setup:static-content:deploy.

like image 117
PedroKTFC Avatar answered Oct 01 '22 16:10

PedroKTFC


I think this error is due to a broken reference in some XML file. You have not mentioned in which page you are getting this error. But you can trace it as below:

First of all, rename your default.xml from below path:

app/design/frontend/Vendor/Theme_name/Magento_Theme/layout/default.xml

Flush all the cache and check(php bin/magento cache:flush)

If you don't find anything then rename your page(homepage, listing, detail page, etc) related file.

For example, if you are getting this error on the homepage then rename cms_index_index.xml.It can reside in your theme or any custom extension.

Hopefully, this information can help you with the issue.

like image 34
Purvi Pandya Avatar answered Oct 01 '22 18:10

Purvi Pandya