Skip to content

Conversation

@Magnesium38
Copy link
Contributor

@Magnesium38 Magnesium38 commented Nov 17, 2025

The HttpGateway currently determines whether the SSR server is healthy by looking at the status of the response to the health check endpoint. If the server is not available at all though, there will be no response and a ConnectionException will occur. This causes the check-ssr command to fail quite aggressively due to an exception getting thrown without being caught.

Instead of letting that exception fall through, it seems reasonable to rescue the exception in the isHealthy method and say that it's not healthy if an exception occurred. Additionally, I also feel it's reasonable to not report said exception, but I don't have a strong opinion either way. The way that I noticed this was from seeing this exception after deploying while waiting for the SSR server to start up. In that scenario, I'm not concerned with the ConnectionException as the command is the failure indicator that is actually useful.

I had originally wrote the test implementation using ->pushFailedConnection(), but that was only added in Laravel 11. In order to keep the Laravel 10 support, I took the implementation of the exception from the PR that added it. laravel/framework#53485

@pascalbaljet
Copy link
Member

Thanks! I've refactored it a bit so we can easily swap the static rejectionForFailedConnection() method when we drop support for Laravel 10.

@pascalbaljet pascalbaljet merged commit 041e148 into inertiajs:2.x Nov 26, 2025
23 checks passed
@Magnesium38 Magnesium38 deleted the handle-connection-exceptions branch November 26, 2025 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants