YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: add retry to cli publish because of know bun error with fetch
Louis Beaumontebe5e8541d63
diff --git a/screenpipe-js/cli/package.json b/screenpipe-js/cli/package.jsonindex ed28aa94c..a6a56d082 100644--- a/screenpipe-js/cli/package.json+++ b/screenpipe-js/cli/package.json@@ -1,6 +1,6 @@{"name": "@screenpipe/dev",- "version": "1.1.3",+ "version": "1.1.4","description": "screenpipe development CLI","type": "module","main": "dist/index.js",diff --git a/screenpipe-js/cli/src/commands/publish.ts b/screenpipe-js/cli/src/commands/publish.tsindex 06befdd0d..739936e8a 100644--- a/screenpipe-js/cli/src/commands/publish.ts+++ b/screenpipe-js/cli/src/commands/publish.ts@@ -68,6 +68,34 @@ function archiveStandardProject(});}+async function retryFetch(+ url: string,+ options: RequestInit,+ maxRetries = 3,+ baseDelay = 1000+): Promise<Response> {+ for (let attempt = 1; attempt <= maxRetries; attempt++) {+ try {+ const response = await fetch(url, options);+ if (response.ok) return response;++ // If it's the last attempt, throw the error+ if (attempt === maxRetries) {+ throw new Error(+ `Failed after ${maxRetries} attempts: ${await response.text()}`+ );+ }+ } catch (error) {+ if (attempt === maxRetries) throw error;+ }++ // Exponential backoff delay+ const delay = baseDelay * Math.pow(2, attempt - 1);+ await new Promise((resolve) => setTimeout(resolve, delay));+ }+ throw new Error("Retry failed"); // Fallback error+}+export const publishCommand = command({name: "publish",desc: "publish or update a pipe to the store",@@ -250,7 +278,7 @@ export const publishCommand = command({// Upload directly to Supabaseconsole.log(colors.dim(`${symbols.arrow} Uploading to storage...`));- const uploadResponse = await fetch(uploadUrl, {+ const uploadResponse = await retryFetch(uploadUrl, {method: "PUT",headers: {"Content-Type": "application/zip",