502 request error, Unable to find DB_HOST in wp-config after upgrading

Issue Summary

_Since upgrading my Local version, I have been unable to access my local site and am being presented with a 502 error. I have noticed that after the upgrade, Local didn’t have full file permissions and I wasn’t re-prompted to allow for this. I have now done this, and the issue still occurs.

The database tab shows a series of errors but I am able to access via Adminer._

2021/05/03 22:03:44 [error] 16708#0: *2 kevent() reported that connect() failed (61: Connection refused) while connecting to upstream, client: 127.0.0.1, server: momentum-tuning.local, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:10003/", host: "momentum-tuning.local"

Troubleshooting Questions

  • Does this happen for all sites in Local, or just one in particular?
    I don’t have any other sites, so it is only effecting this one.

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser?
    Yes, I can access a test site without any issues.

Replication

Just starting the site, and trying to access it via a browser.local-lightning.log (140.6 KB)

System Details

  • Which version of Local is being used?
    5.10.3+5332

  • What Operating System (OS) and OS version is being used?

    • MacOS, 11.2.1
  • Attach the Local Log. See this Community Forum post for instructions on how to do so:

    • It’s attached above under the Replication subject. I couldn’t move it.

Welcome to the community @thewebsitecompany!

I wonder if somehow the site became corrupted when updating Local?

Can you try restoring the site to a new one in Local? You can use a backup of the site, or try using the files for the site by following the steps outlined in the “Restoring From Only Local Site files” section of this help doc:

Hi @ben.turner,

This appears to have been the case. I just re-imported the same site into Local following those instructions, and it works just fine.

A bug report should be raised with the developers.

Thanks,
Bex

If anyone reads this and has the same problem, I was able to solve the problem by re-importing the site using these “Restoring From Only Local Site files” instructions:

https://localwp.com/help-docs/how-to-import-a-wordpress-site-into-local/

However, I had to export each SQL file in the DB separately and place them in a new “SQL” folder, inside the site folder as they didn’t previously exist.

So:
Site Name > app > public > sql > List of .sql files

This has happened to me on 3 separate occasions over the past two days. Everything is up to date, both Local and MacOS. Today, it was working fine but left the office for a few hours without shutting anything down except for the browser window (Firefox). I reopened Firefox and tried to open the site but received the 502/DB error. Shut down the site and Local, restarted with no luck. Rebooted with no luck. Shut it all down again and waited 20 minutes. It’s all working again.

Same scenario yesterday, twice.

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.