Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(upgrade): handle missing status after restart (#11350)

Andras Bacsaic9d5c4c41fc4
diff --git a/resources/views/livewire/upgrade.blade.php b/resources/views/livewire/upgrade.blade.php
index f93c7bcea7..97c08c0357 100644
--- a/resources/views/livewire/upgrade.blade.php
+++ b/resources/views/livewire/upgrade.blade.php
@@ -295,6 +295,16 @@
}
throw error;
}
+ if (!data) {
+ if (this.instanceWentDown) {
+ // The upgraded instance can no longer return data for the old Livewire component.
+ // A healthy response after observed downtime confirms that the restart completed.
+ this.showSuccess();
+ } else {
+ this.currentStatus = this.getReviveStatusMessage(elapsedMinutes, this.healthCheckAttempts);
+ }
+ return;
+ }
if (data.status === 'complete') {
this.showSuccess();
} else if (data.status === 'error') {
diff --git a/tests/Unit/CoolifyUpgradeStatusTest.php b/tests/Unit/CoolifyUpgradeStatusTest.php
index a00283615f..2248e382b5 100644
--- a/tests/Unit/CoolifyUpgradeStatusTest.php
+++ b/tests/Unit/CoolifyUpgradeStatusTest.php
@@ -149,6 +149,16 @@ it('finishes after health recovers from observed downtime for older target relea
->toContain('return;');
});
+it('finishes when the post-restart Livewire status response is undefined', function () {
+ $upgradeView = file_get_contents(__DIR__.'/../../resources/views/livewire/upgrade.blade.php');
+
+ expect($upgradeView)
+ ->toContain('if (!data) {')
+ ->toContain('if (this.instanceWentDown) {')
+ ->toContain('this.showSuccess();')
+ ->toContain('return;');
+});
+
it('tells users to reload manually if the automatic reload does not happen', function () {
$upgradeView = file_get_contents(__DIR__.'/../../resources/views/livewire/upgrade.blade.php');