From 3fa26309d56e9da4672cabc2c4e6ebe786106555 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 1 Apr 2025 16:35:38 +0200 Subject: [PATCH] Fix SDK client initialization during build --- src/lib/stores/sdk.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/stores/sdk.ts b/src/lib/stores/sdk.ts index 8386d0007..da4fc6d98 100644 --- a/src/lib/stores/sdk.ts +++ b/src/lib/stores/sdk.ts @@ -30,17 +30,18 @@ import { building } from '$app/environment'; export function getApiEndpoint(): string { if (VARS.APPWRITE_ENDPOINT) return VARS.APPWRITE_ENDPOINT; - if (building) return 'https://cloud.appwrite.io/v1'; return globalThis?.location?.origin + '/v1'; } const endpoint = getApiEndpoint(); const clientConsole = new Client(); -clientConsole.setEndpoint(endpoint).setProject('console'); - const clientProject = new Client(); -clientProject.setEndpoint(endpoint).setMode('admin'); + +if (!building) { + clientConsole.setEndpoint(endpoint).setProject('console'); + clientProject.setEndpoint(endpoint).setMode('admin'); +} const sdkForProject = { client: clientProject,