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: prevent TypeError in database General components with null server

Andras Bacsai74c70b431cfa
diff --git a/app/Livewire/Project/Database/Clickhouse/General.php b/app/Livewire/Project/Database/Clickhouse/General.php
index b80775853e..d41609c75b 100644
--- a/app/Livewire/Project/Database/Clickhouse/General.php
+++ b/app/Livewire/Project/Database/Clickhouse/General.php
@@ -16,7 +16,7 @@ class General extends Component
{
use AuthorizesRequests;
- public Server $server;
+ public ?Server $server = null;
public StandaloneClickhouse $database;
@@ -58,6 +58,11 @@ class General extends Component
try {
$this->syncData();
$this->server = data_get($this->database, 'destination.server');
+ if (! $this->server) {
+ $this->dispatch('error', 'Database destination server is not configured.');
+
+ return;
+ }
} catch (\Throwable $e) {
return handleError($e, $this);
}
diff --git a/app/Livewire/Project/Database/Dragonfly/General.php b/app/Livewire/Project/Database/Dragonfly/General.php
index 4b93e69d75..69633e302a 100644
--- a/app/Livewire/Project/Database/Dragonfly/General.php
+++ b/app/Livewire/Project/Database/Dragonfly/General.php
@@ -18,7 +18,7 @@ class General extends Component
{
use AuthorizesRequests;
- public Server $server;
+ public ?Server $server = null;
public StandaloneDragonfly $database;
@@ -64,6 +64,11 @@ class General extends Component
try {
$this->syncData();
$this->server = data_get($this->database, 'destination.server');
+ if (! $this->server) {
+ $this->dispatch('error', 'Database destination server is not configured.');
+
+ return;
+ }
$existingCert = $this->database->sslCertificates()->first();
diff --git a/app/Livewire/Project/Database/Keydb/General.php b/app/Livewire/Project/Database/Keydb/General.php
index 016dc4e01d..20d0486dcb 100644
--- a/app/Livewire/Project/Database/Keydb/General.php
+++ b/app/Livewire/Project/Database/Keydb/General.php
@@ -18,7 +18,7 @@ class General extends Component
{
use AuthorizesRequests;
- public Server $server;
+ public ?Server $server = null;
public StandaloneKeydb $database;
@@ -66,6 +66,11 @@ class General extends Component
try {
$this->syncData();
$this->server = data_get($this->database, 'destination.server');
+ if (! $this->server) {
+ $this->dispatch('error', 'Database destination server is not configured.');
+
+ return;
+ }
$existingCert = $this->database->sslCertificates()->first();
diff --git a/app/Livewire/Project/Database/Mariadb/General.php b/app/Livewire/Project/Database/Mariadb/General.php
index d565c61669..4de73f61c2 100644
--- a/app/Livewire/Project/Database/Mariadb/General.php
+++ b/app/Livewire/Project/Database/Mariadb/General.php
@@ -18,7 +18,7 @@ class General extends Component
{
use AuthorizesRequests;
- public Server $server;
+ public ?Server $server = null;
public StandaloneMariadb $database;
@@ -124,6 +124,11 @@ class General extends Component
try {
$this->syncData();
$this->server = data_get($this->database, 'destination.server');
+ if (! $this->server) {
+ $this->dispatch('error', 'Database destination server is not configured.');
+
+ return;
+ }
$existingCert = $this->database->sslCertificates()->first();
diff --git a/app/Livewire/Project/Database/Mongodb/General.php b/app/Livewire/Project/Database/Mongodb/General.php
index f5ecfba1cc..534e90bc4c 100644
--- a/app/Livewire/Project/Database/Mongodb/General.php
+++ b/app/Livewire/Project/Database/Mongodb/General.php
@@ -18,7 +18,7 @@ class General extends Component
{
use AuthorizesRequests;
- public Server $server;
+ public ?Server $server = null;
public StandaloneMongodb $database;
@@ -124,6 +124,11 @@ class General extends Component
try {
$this->syncData();
$this->server = data_get($this->database, 'destination.server');
+ if (! $this->server) {
+ $this->dispatch('error', 'Database destination server is not configured.');
+
+ return;
+ }
$existingCert = $this->database->sslCertificates()->first();
diff --git a/app/Livewire/Project/Database/Mysql/General.php b/app/Livewire/Project/Database/Mysql/General.php
index 22c6eb39ea..b66165527c 100644
--- a/app/Livewire/Project/Database/Mysql/General.php
+++ b/app/Livewire/Project/Database/Mysql/General.php
@@ -20,7 +20,7 @@ class General extends Component
public StandaloneMysql $database;
- public Server $server;
+ public ?Server $server = null;
public string $name;
@@ -129,6 +129,11 @@ class General extends Component
try {
$this->syncData();
$this->server = data_get($this->database, 'destination.server');
+ if (! $this->server) {
+ $this->dispatch('error', 'Database destination server is not configured.');
+
+ return;
+ }
$existingCert = $this->database->sslCertificates()->first();
diff --git a/app/Livewire/Project/Database/Postgresql/General.php b/app/Livewire/Project/Database/Postgresql/General.php
index 5314d10840..eae6870b67 100644
--- a/app/Livewire/Project/Database/Postgresql/General.php
+++ b/app/Livewire/Project/Database/Postgresql/General.php
@@ -20,7 +20,7 @@ class General extends Component
public StandalonePostgresql $database;
- public Server $server;
+ public ?Server $server = null;
public string $name;
@@ -142,6 +142,11 @@ class General extends Component
try {
$this->syncData();
$this->server = data_get($this->database, 'destination.server');
+ if (! $this->server) {
+ $this->dispatch('error', 'Database destination server is not configured.');
+
+ return;
+ }
$existingCert = $this->database->sslCertificates()->first();
diff --git a/app/Livewire/Project/Database/Redis/General.php b/app/Livewire/Project/Database/Redis/General.php
index a24a977ad7..6a17a60530 100644
--- a/app/Livewire/Project/Database/Redis/General.php
+++ b/app/Livewire/Project/Database/Redis/General.php
@@ -18,7 +18,7 @@ class General extends Component
{
use AuthorizesRequests;
- public Server $server;
+ public ?Server $server = null;
public StandaloneRedis $database;
@@ -117,6 +117,11 @@ class General extends Component
try {
$this->syncData();
$this->server = data_get($this->database, 'destination.server');
+ if (! $this->server) {
+ $this->dispatch('error', 'Database destination server is not configured.');
+
+ return;
+ }
$existingCert = $this->database->sslCertificates()->first();