White screen of death - Sage can't find compiled templates after WPE deploy

Hi all,

Pulling my hair out with a strange issue in a Sage 9.0.9 theme deployed (I know, I know!) to WPE. I have several other sites running Sage themes in WPE, but none of them are running a newer version of Sage than 9.0.4. No response at all from WP… I’m at a loss to troubleshoot further.

  • No errors in either the WPE interface or uploads/debug.log
  • My CI pipeline is appears to be running exactly as intended. Compiled Blade templates end up in the root /tmp/sage-cache
  • Theme activates successfully, customizer options show up as I would expect
  • I manually loaded the vendor dir over FTP
  • Permissions appear fine ( templates are all rw-rw-r— )
  • Theme is equally busted in production and staging environments

My theme dir looks like this:

 |- Controllers
 |  |- App, etc. 
 |- admin.php
 |- filters.php
 |- helpers.php
 |- setup.php
 |-  assets.php
 |-  theme.php
 |-  view.php
 |- scripts  
 |  |- customizer.js
 |  |- customizer.js.map
 |  |- main.js
 |  |- main.js.map
 |- styles
 |  |- main.css
 |  |- main.css.map  
 |  |- functions.php
 |  |- index.php
 |  |- screenshot.png
 |  |- style.css
 | carbon copy of local install

What am I missing… is there any way determine if the file location in my template hash is somehow off?


Hey @jamesfacts - just checking: have you enabled debugging on your staging environment to see if you can get an error message?

Also, is your PHP version on WPE compatible with the newer versions of Sage?

Thanks @mmirus! I don’t think I can SSH into the staging environment to review the debug log… there’s nothing in the WPE portal error logs for staging, and nothing in the production debug log either. Yes, using php 7.2 on WPE.

I’m almost certain the hash in the compiled templates is based around an incorrect path but I can’t think of a good way to investigate.

Oh, I just meant manually enable it all in wp-config so that you can visually see anything when you try to load the staging site. Not elegant, but useful as a quick triage step.

Are you uploading the compiled templates rather than letting them be generated on the server? :thinking:

Yep, I have front-end logging enabled, so in theory I could see… but the application doesn’t get that far.

I am compiling the templates in CI and pushing them to the server. That’s how I’ve deployed Sage themes to WPE in the past, using Ben’s blade-generate package.

Ah, gotcha. You can ping him on here if you think it might be related to that. Not something I’m familiar with!

Can you switch the staging site to a stock Sage 9 theme of the same version to see if that loads? I’d start with it just generating the templates on the server rather than pushing them via your CI service. If that doesn’t work, could be something different between Sage 9.0.4 and 9.0.9 (though I think I was running 9.0.9 on WPE before I migrated hosts) or a plugin. If that does work, you can add in the CI part. If it still works, it’s probably something in your theme customizations.

1 Like

There are no plugins on the site at this point—I wanted to get the deployment pipeline set up before doing anything fancy, so this is pretty close to a stock 9.0.9 setup. I can absolutely test a totally untouched theme too, that’s a good idea.

CAN a Sage Theme in WPE generate templates at all? I thought there was an issue in allowing vendor scripts to write to the WPE filesystem. I just tried a quick test: I switched config/views.php to point to the normal cache location, uploads/cache. The theme does make an uploads/cache dir when I attempt to ping a URL, but it doesn’t generate any blade templates inside it. Hmm. Permissions on the uploads/cache are drwxrwxr-x, same as everything else in uploads.

Yup, I ran Sage 9 on WP Engine for a long time, and all you need to do is update the compiled path in config/view.php. Using 'compiled' => '/tmp/sage-cache' should work fine with no additional customization needed:

Once you make that change it should be able to compile your templates no problem unless something changed over the last few months since we switched.

1 Like

You are absolutely right! I think my issue might have been that I was blocking the non-compiled templates in my .gitignore… once I pushed those everything snapped back to normal. When I first started using Sage9 on WPE it was impossible to load source templates at runtime but obviously that’s not the case anymore.

You are a life-saver. Thanks so much!

1 Like

This topic was automatically closed after 42 days. New replies are no longer allowed.