79507731

Date: 2025-03-13 22:08:19
Score: 1
Natty:
Report link

2025 still running into this cryptic error message:

Can't connect to MySQL server on 'localhost' ([Errno 2] No such file or directory)")

I had 2 cloud run functions connecting to the same SQL instance, one working and the other getting that error message. The code was literally copy-paste from the working to the not-working.

The above link from @Josh Bloom gave me the idea to contrast "gcloud run services describe x" output and, sure enough, the working service had a "SQL connection" defined and the other didn't. I added the missing connection in the console and the bad guy started working.

What gives? I generated both these cloud run functions from the same laptop, with the same "gcloud functions deploy" and the same exact code copy-pasted.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • User mentioned (1): @Josh
  • Low reputation (0.5):
Posted by: Yanay Lehavi