From cfd0c6aa819b4a647dfba4ece854bef77c39efaa Mon Sep 17 00:00:00 2001 From: dtoro Date: Sun, 7 Jun 2026 00:13:01 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20rename=20sidecar()=20helper=20=E2=86=92?= =?UTF-8?q?=20callSidecar()=20and=20fix=20mariadb=20healthcheck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new `const sidecar` axios instance (added in 243e5d3) clashed with the pre-existing `async function sidecar()` fetch helper, causing `npm run build` to fail with a rolldown redeclaration error. Rename the fetch helper and all its call sites to `callSidecar`. Also replace the mariadb healthcheck command: `healthcheck.sh` calls the `mariadb` CLI which isn't on PATH in the current image layer, causing the container to stay permanently unhealthy and the deploy webhook to abort before the `npm run build` step runs — leaving the old JS bundle serving from nginx. Switch to `mysqladmin ping` which is available in all MariaDB 11 images. Co-Authored-By: Claude Sonnet 4.6 --- docker-compose.yml | 2 +- web/src/lib/services/photoprism.ts | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index bed6d2d..335c697 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,7 +42,7 @@ services: # silently no-op on Debian/Ubuntu and macOS Docker Desktop. - ./mariadb/init:/docker-entrypoint-initdb.d:ro,Z healthcheck: - test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] + test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"] interval: 10s timeout: 5s retries: 12 diff --git a/web/src/lib/services/photoprism.ts b/web/src/lib/services/photoprism.ts index 537c7a9..dca1d84 100644 --- a/web/src/lib/services/photoprism.ts +++ b/web/src/lib/services/photoprism.ts @@ -529,7 +529,7 @@ export async function listFolderCounts(paths: string[]): Promise toOriginalsPath(p)); - const data = (await sidecar('POST', '/folders/counts', { paths: serverPaths })) as Record< + const data = (await callSidecar('POST', '/folders/counts', { paths: serverPaths })) as Record< string, number >; @@ -875,7 +875,7 @@ export interface RenameResult { newRelPath: string; } -async function sidecar(method: string, urlPath: string, body?: unknown): Promise { +async function callSidecar(method: string, urlPath: string, body?: unknown): Promise { const res = await fetch(`/api/sidecar${urlPath}`, { method, headers: { @@ -893,20 +893,20 @@ async function sidecar(method: string, urlPath: string, body?: unknown): Promise } export async function createFolder(relPath: string): Promise<{ path: string }> { - return sidecar('POST', '/folders', { path: relPath }) as Promise<{ path: string }>; + return callSidecar('POST', '/folders', { path: relPath }) as Promise<{ path: string }>; } export async function renameFolder( relPath: string, newName: string ): Promise<{ oldPath: string; newPath: string }> { - return sidecar('POST', `/folders/${encodeURIComponent(relPath)}/rename`, { + return callSidecar('POST', `/folders/${encodeURIComponent(relPath)}/rename`, { newName }) as Promise<{ oldPath: string; newPath: string }>; } export async function deleteFolder(relPath: string): Promise<{ path: string }> { - return sidecar('DELETE', `/folders/${encodeURIComponent(relPath)}`) as Promise<{ + return callSidecar('DELETE', `/folders/${encodeURIComponent(relPath)}`) as Promise<{ path: string; }>; } @@ -939,7 +939,7 @@ export interface CrossFolderScanResult { } export async function scanCrossFolderDuplicates(): Promise { - return sidecar('GET', '/duplicates/scan') as Promise; + return callSidecar('GET', '/duplicates/scan') as Promise; } export interface ArchiveDuplicatesResult { @@ -950,7 +950,7 @@ export interface ArchiveDuplicatesResult { export async function archiveDuplicatePaths( paths: string[] ): Promise { - return sidecar('POST', '/duplicates/archive', { paths }) as Promise; + return callSidecar('POST', '/duplicates/archive', { paths }) as Promise; } // ── Heap convert (move/copy heap photos to a folder) ──────────────────────── @@ -982,7 +982,7 @@ export async function convertHeap( uid: string, body: HeapConvertBody ): Promise { - return sidecar('POST', `/albums/${uid}/convert`, body) as Promise; + return callSidecar('POST', `/albums/${uid}/convert`, body) as Promise; } // ── Photo marks (rating + color) ───────────────────────────────────────────── @@ -998,19 +998,19 @@ export interface PhotoMark { export type PhotoMarksMap = Record; export async function getAllMarks(): Promise { - const data = await sidecar('GET', '/photos/marks'); + const data = await callSidecar('GET', '/photos/marks'); return (data ?? {}) as PhotoMarksMap; } export async function setMark(photoUid: string, patch: PhotoMark): Promise { - return sidecar('PUT', `/photos/${photoUid}/marks`, patch) as Promise; + return callSidecar('PUT', `/photos/${photoUid}/marks`, patch) as Promise; } export async function bulkSetMarks( ids: string[], patch: PhotoMark ): Promise<{ count: number; marks: PhotoMarksMap }> { - return sidecar('POST', '/photos/marks/bulk', { ids, patch }) as Promise<{ + return callSidecar('POST', '/photos/marks/bulk', { ids, patch }) as Promise<{ count: number; marks: PhotoMarksMap; }>;