From 8ceaebb268af69c47a7c6c48eb3c76add9bdd610 Mon Sep 17 00:00:00 2001 From: Jennie Robinson Faber Date: Sat, 18 Apr 2026 22:06:33 +0100 Subject: [PATCH] fix(helcim): tolerate empty response body on DELETE (204) helcimFetch called response.json() unconditionally, which threw "Unexpected end of JSON input" on Helcim's 204 No Content responses (e.g. DELETE /subscriptions/:id). The error was silently swallowed by the best-effort cancel path in cancel-subscription, masking cases where the Helcim-side cancel actually succeeded. --- server/utils/helcim.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/utils/helcim.js b/server/utils/helcim.js index a0a28c8..d891612 100644 --- a/server/utils/helcim.js +++ b/server/utils/helcim.js @@ -63,7 +63,13 @@ export async function helcimFetch(path, { method = 'GET', body, idempotencyKey, }) } - return await response.json() + const text = await response.text() + if (!text.trim()) return null + try { + return JSON.parse(text) + } catch { + return null + } } // ---- Customers ----