Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x]: Craft does not serve custom error templates for 50x error codes when the database is empty or does not exist #11855

Closed
aaronbushnell opened this issue Aug 31, 2022 · 3 comments
Assignees

Comments

@aaronbushnell
Copy link
Contributor

What happened?

Description

When Craft is unable to make a connection to the database or the database contents are emptied/being imported from scratch (causing a 500/503 error) the custom error templates are not rendered.

When using a hosting provider with the ability to restore a database backup (Servd is one such host) the database is emptied and then the backup is imported to take its place.

During this time, even with a 500.twig, 503.twig, offline.twig, and error.twig none of these templates will be shown during this process. Instead you receive (what seems to be) Yii's general error message:

An internal server error occurred.

Steps to reproduce

  1. Create an error.twig template
  2. Set invalid database credentials
  3. Disable dev mode
  4. Visit site and see that the error.twig template is not rendered

Expected behavior

The error.twig template should display

Actual behavior

A general "An internal server error occurred." is shown

Craft CMS version

3.7.x (and 4.x)

PHP version

8.0.22

Operating system and version

Darwin 21.6.0

Database type and version

MySQL 5.7.38

Image driver and version

GD 8.0.22

Installed plugins and versions

None

@brandonkelly
Copy link
Member

brandonkelly commented Sep 5, 2022

This should be fixed for the next Craft 3 and 4 releases! (#11859)

@aaronbushnell
Copy link
Contributor Author

Thank you, @brianjhanson and @brandonkelly!

@brandonkelly
Copy link
Member

Craft 3.7.54 and 4.2.4 are now tagged with that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants