Error 404 on all pages due to Content Staging issue
This article provides a fix for the Adobe Commerce on-premises and Adobe Commerce on cloud infrastructure issue where you get a 404 error when accessing any storefront page or the Commerce Admin.
Affected products and versions
- Adobe Commerce on-premises 2.2.x, 2.3.x
- Adobe Commerce on cloud infrastructure 2.2.x, 2.3.x
Issue
Accessing any storefront page or the Admin results in the 404 error (the “Whoops, our bad…” page) after performing operations with scheduled updates for store content assets using Content Staging (updates for store content assets scheduled using the Magento_Staging module). For example, you may have deleted a Product with a scheduled update or removed the end date for the scheduled update.
A store content asset includes:
- Product
- Category
- Catalog Price Rule
- Cart Price Rule
- CMS Page
- CMS Block
- Widget
Some scenarios are discussed in the Cause section below.
Cause
The flag
table in the database (DB) contains invalid links to the staging_update
table.
The problem is related to Content Staging. Below are two particular scenarios; please note there might be more situations that trigger the issue.
Scenario 1: Deleting a store content asset which:
- has an update scheduled with Content Staging
- the update has an end date (meaning the expiry date after which the updated asset reverts to its previous version)
- the end date of the update is in the past
At the same time, the issue might not occur if a deleted asset has no end date for the scheduled update.
Scenario 2: Removing the end date/time of a scheduled update.
Identify if your issue is related
To identify if the issue you are experiencing is the one described in this article, run the following DB query:
SELECT f.flag_data >'$.current_version' as flag_version, (su.id IS NOT NULL) as update_exists
-> FROM flag f
-> LEFT JOIN staging_update su
-> ON su.id = f.flag_data >'$.current_version'
-> WHERE flag_code = 'staging';
If the query returns a table where update_exists
value is “0”, then an invalid link to the staging_update
table exists in your database, and the steps described in the Solution section will help to solve the issue. The following is an example of the query result with update_exists
value equal to “0”:
If the query returns a table where update_exists
value is “1” or an empty result, it means your issue is not related to staging updates. The following is an example of the query result with update_exists
value equal to “1”:
In this case, you might refer to the Site Down Troubleshooter for troubleshooting ideas.
Solution
-
Run the following query to delete the invalid link to the
staging_update
table:code language-sql DELETE FROM flag WHERE flag_code = 'staging';
-
Wait for the cron job to run (runs in up to five minutes if set up properly) or run it manually if you do not have cron set up.
The problem should be solved straight after fixing the invalid link. If the problem persists, submit a support ticket.
Related reading
Best practices for modifying database tables in the Commerce Implementation Playbook