I've had a 504 Gateway Timed Out
error for two days on my website hosted on Laravel Forge.
After a lot of investigation and testing, I've deduced that only certain models are causing the problem (such as users or media).
Some things work, such as User::find(1)
for example, but User::all()
(40 entries in the database) doesn't work.
An example of the nginx logs:
2024/01/18 15:31:37 [error] 23247#23247: *1216 upstream timed out (110: Connection timed out) while reading response header from upstream, client: ***.***.***.***, server: *****.com, request: "GET /bibliotheque/images HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.3-fpm.sock", host: "****.com"
I've tried everything, changing things in the PHP-FPM pool configuration, nginx...
I've run out of ideas...
I tried to
And nothing works
In case anyone had the same problem, I'd finally managed to find it.
There was a problem with the $with on models that created infinite loops when the same model was called elsewhere with the ::with... method.
After fixing that, everything worked again :)