From fb1504d50e934db2a9bd8d76f5e22b4a468947e8 Mon Sep 17 00:00:00 2001 From: Morrow Contributors Date: Sat, 8 Aug 2026 16:32:40 +0800 Subject: [PATCH] fix: identify identity-rail requests with a User-Agent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shopify's edge rejects requests without a User-Agent header with a 403, and a Workers-runtime fetch sends none by default, so discovery — and with it the whole sign-in flow — failed in production while working from a browser or curl. Send an identifying agent on every identity request. Co-Authored-By: Claude Fable 5 --- apps/desk/src/identity/shopify-customer.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/desk/src/identity/shopify-customer.ts b/apps/desk/src/identity/shopify-customer.ts index 0f86772..bd136ed 100644 --- a/apps/desk/src/identity/shopify-customer.ts +++ b/apps/desk/src/identity/shopify-customer.ts @@ -84,7 +84,13 @@ export function resetShopifyCustomerDiscoveryCache(): void { async function fetchJson(fetcher: typeof fetch, url: string, init: RequestInit, timeoutMs: number): Promise { try { - const response = await fetcher(url, { ...init, signal: AbortSignal.timeout(timeoutMs) }) + const response = await fetcher(url, { + ...init, + // Shopify's edge rejects requests without a User-Agent (403), and a + // Workers-runtime fetch sends none by default. + headers: { 'user-agent': 'Able-Desk/1.0 (+https://github.com/codeyogi911/able)', accept: 'application/json', ...(init.headers ?? {}) }, + signal: AbortSignal.timeout(timeoutMs), + }) if (!response.ok) { logOutcome('http_error', { url: new URL(url).pathname, status: response.status }) return null