The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Providers: a key test that couldn't reach fal.ai or Higgsfield no longer says "Key accepted"
Claudec12fb4e2a4d0
diff --git a/src/server/providers/fal.ts b/src/server/providers/fal.tsindex 883c506d..6d3ce6e7 100644--- a/src/server/providers/fal.ts+++ b/src/server/providers/fal.ts@@ -123,6 +123,8 @@ export const falProvider: ProviderAdapter = {return { ok: false, detail: `Can't reach fal.ai (${(e as Error).message})` };}if (res.status === 401 || res.status === 403) return { ok: false, detail: `Key rejected (${res.status})` };- return { ok: true, detail: "Key accepted" };+ if (res.ok || [400, 404, 422].includes(res.status)) return { ok: true, detail: "Key accepted" };+ // A proxy or an outage (405, 407, 5xx) says nothing about the key: don't call it accepted.+ return { ok: false, detail: `Couldn't check the key: fal.ai answered ${res.status}. Try again in a moment` };},};diff --git a/src/server/providers/higgsfield.ts b/src/server/providers/higgsfield.tsindex dbf39ef9..05a4e7ab 100644--- a/src/server/providers/higgsfield.ts+++ b/src/server/providers/higgsfield.ts@@ -149,7 +149,10 @@ export const higgsfieldProvider: ProviderAdapter = {return { ok: true, detail: "Key accepted" };} catch (e) {const status = (e as ProviderError).status;- return status === 401 ? { ok: false, detail: "Key rejected (401)" } : { ok: true, detail: `Key accepted (list returned ${status ?? "an error"})` };+ if (status === 401 || status === 403) return { ok: false, detail: `Key rejected (${status})` };+ // The key got past auth, the list call itself failed.+ if (status === 400 || status === 404 || status === 422) return { ok: true, detail: `Key accepted (list returned ${status})` };+ return { ok: false, detail: status ? `Couldn't check the key: Higgsfield answered ${status}. Try again in a moment` : `Can't reach Higgsfield (${(e as Error).message})` };}},};diff --git a/tests/connections.test.ts b/tests/connections.test.tsindex dd351354..63c43385 100644--- a/tests/connections.test.ts+++ b/tests/connections.test.ts@@ -127,6 +127,9 @@ describe("POST /api/providers/test with unsaved values", () => {const bad = await withFetch({ "https://queue.fal.run/": [401, { detail: "Unauthorized" }] }, () => post({ provider: "fal", values: { falKey: "fal_only_half" } }));expect(bad.result.body.ok).toBe(false);expect(bad.result.body.detail).toMatch(/^Key rejected \(401\) — fal\.ai keys look like key_id:key_secret/);+ // A proxy or an outage isn't a verdict on the key.+ const blocked = await withFetch({ "https://queue.fal.run/": [405, {}] }, () => post({ provider: "fal", value: "new-id:new-secret" }));+ expect(blocked.result.body).toEqual({ ok: false, detail: "Couldn't check the key: fal.ai answered 405. Try again in a moment" });// Without values it tests the saved key.const saved = await withFetch({ "https://queue.fal.run/": [404, {}] }, () => post({ provider: "fal" }));expect(saved.seen[0].auth).toBe("Key saved-id:saved-secret");