After moving my app to Laravel Forge (Hetzler vps) code with defer stop working and site return 502 response and only that I can see in log - its PHP error log:
WARNING: [pool www] child 86918 exited with code 255 after 22.445599 seconds from start
@puklipo Thanks! I managed to get it working by disabling the swoole extension and then restarting PHP through Forge.
For anyone looking to do the same, I disabled it by moving it outside of the conf folder (in case it's needed again in future):
mv /etc/php/8.3/fpm/conf.d/25-swoole.ini /etc/php/8.3/fpm/25-swoole.ini