2

I am preparing to upgrade a site from Craft 2 to 3, and would like to make a custom template to deal with the 503 Service Unavailable when the migrations need to be run.

I have set devMode to false and tried creating templates/503.html and also templates/offline.html, which just contain some plain HTML (no Twig/Craft functions) but each time I get:

An internal server error occurred.

If I turn devMode back on, I can see where the craft\web\ServiceUnavailableHttpException is being thrown in craft\web\Application->_processUpdateLogic() and above it says in comments:

// If an exception gets throw during the rendering of the 503 template, let
// TemplatesController->actionRenderError() take care of it.

However, I can't see this method trying to find and/or serve a 503.html template, or see what is wrong with the template I've created?

1

Check your phperrors.log and see if there are any errors with your 503 template. As you posted, if it encounters any errors in the template, it will just render the 503 error message instead.

I was confounded by the same issue and found it was catching an error with my include statement. Even though the file hadn't changed, Craft3 was throwing an exception where Craft2 never cared before.

In the log, it'll spit out the stack trace after the human-readable error, so you might want to search for the date you were testing (format example: 10-Oct-2018). There it should say what the error was and where it occurred.

Hope that helps!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.