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: do not error if proxy is not running

Andras Bacsai8ae61c8f78fc
diff --git a/src/lib/haproxy/configuration.ts b/src/lib/haproxy/configuration.ts
index 97cb76c971..0bfebde819 100644
--- a/src/lib/haproxy/configuration.ts
+++ b/src/lib/haproxy/configuration.ts
@@ -112,9 +112,15 @@ export async function haproxyInstance() {
}
export async function configureHAProxy() {
+ const haproxy = await haproxyInstance();
+
try {
- const haproxy = await haproxyInstance();
await checkHAProxy(haproxy);
+ } catch (error) {
+ return 'Error: HAProxy is not running';
+ }
+
+ try {
const data = {
applications: [],
services: [],
diff --git a/src/lib/haproxy/index.ts b/src/lib/haproxy/index.ts
index b41f9035ea..39190384d3 100644
--- a/src/lib/haproxy/index.ts
+++ b/src/lib/haproxy/index.ts
@@ -49,7 +49,12 @@ export async function completeTransaction(transactionId) {
}
export async function deleteProxy({ id }) {
const haproxy = await haproxyInstance();
- await checkHAProxy(haproxy);
+ try {
+ await checkHAProxy(haproxy);
+ } catch (error) {
+ return 'Error: HAProxy is not running';
+ }
+
let transactionId;
try {
await haproxy.get(`v2/services/haproxy/configuration/backends/${id}`).json();
diff --git a/src/lib/queues/proxy.ts b/src/lib/queues/proxy.ts
index 3705139ce8..a29b2a2235 100644
--- a/src/lib/queues/proxy.ts
+++ b/src/lib/queues/proxy.ts
@@ -1,4 +1,3 @@
-import { dev } from '$app/env';
import { ErrorHandler } from '$lib/database';
import { configureHAProxy } from '$lib/haproxy/configuration';