Skip to content

502 after a deploy

Roll back live to the previous release, then use the build log, the PHP error log, and wpwaterfall.yml to find why the new release broke.

If live shows a 502 or a PHP fatal error right after a promote, roll back to the previous release first. The old release is still on the server, so the site comes back in seconds and you can find the cause without visitors waiting.

How do I get the site back?

  1. Pick Live, open Info, and click Deploys.
  2. Click Roll back next to the previous release, or call POST /v1/releases/{id}/activate.

The older code goes live with no new build. Rollback changes code only: the database and uploads stay as they are. WP Waterfall keeps the live release and the one before it. See How Git deploys work.

How do I find the cause?

  1. Read the PHP error log. Open Logs, pick php-error.log, and filter by Error. A fatal error names the file and line. Two causes show up most. A class is missing because composer install did not run in the build. A plugin writes into its own folder, which is read only on live.
  2. Read the build log. In Deploys, open the newest build, or call GET /v1/environments/{id}/builds and GET /v1/builds/{id}/log. A failed step creates no release and live does not change, so a failed build is not the cause of a 502. A step that only warned can still leave a release without vendor/ or compiled assets.
  3. Check the PHP version. The php key in wpwaterfall.yml sets the version for the build and the running site. A plugin or theme that does not support it fails on the first request. If you changed the version under Tools, then PHP settings, WP Waterfall checks the homepage and switches back on its own when it answers with a server error.
  4. Check the build steps. Steps run in order in a fresh container, and whatever they create is part of the release. A missing composer install or npm run build leaves files out.
  5. Open the job. The bell lists recent jobs with the notifications. A failed job says what went wrong in plain words. GET /v1/jobs/{id} returns the same.

How do I fix it?

  • A build step is missing. Add it under build in wpwaterfall.yml, push to master, check staging, and promote.
  • A plugin must write into its own folder. That cannot work on live. Only wp-content/uploads and wp-content/cache are writable, and PHP files in them do not run. Ask the plugin for a setting that keeps its files in uploads, or run it on staging in SFTP mode.
  • The PHP version is the cause. Set php in wpwaterfall.yml to a version your code supports, in quotes, or update the plugin in your repository.
  • The error survives a rollback. The release is not the cause. Restart PHP from Tools, then check the PHP settings.

A deploy hook that fails does not change live, so it never causes a 502.

If the promote also copied content into live, restore the restore point from Backups to undo it. WP Waterfall takes one before every promote and keeps it 48 hours. Restoring asks you to type the environment's name.

Still stuck

Message Nami from the chat button with the site name, the environment, the request ID or job ID, the commit you promoted, and the first error line from php-error.log.

Still stuck?

Email support at wpwaterfall dot com with your site name and what you tried, or send us a message.