Skip to content

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

fix: improve R2 upload reliability with s3api fallback

Louis Beaumont41892ab25027
diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml
index 852f35622..8dea42aff 100644
--- a/.github/workflows/release-app.yml
+++ b/.github/workflows/release-app.yml
@@ -983,12 +983,14 @@ jobs:
local r2_key="${bucket_path#*/}"
local bucket="${bucket_path%%/*}"
- # Try aws cli with high multipart threshold to avoid chunked TLS issues
+ # Try aws cli — set 500MB multipart threshold to force single-part upload
for attempt in 1 2 3; do
if AWS_MAX_ATTEMPTS=3 aws s3 cp "$src" "$dst" \
--endpoint-url "$R2_ENDPOINT" \
+ --no-progress \
--expected-size "$(stat -f%z "$src" 2>/dev/null || stat -c%s "$src" 2>/dev/null)" \
- --cli-read-timeout 120 --cli-connect-timeout 30 2>&1; then
+ --cli-read-timeout 300 --cli-connect-timeout 30 \
+ --region auto 2>&1; then
echo " ✅ $(basename "$src") (aws)"
return 0
fi
@@ -996,15 +998,19 @@ jobs:
sleep $((attempt * 5))
done
- # Fallback: presigned URL + curl (uses macOS SecureTransport, more reliable TLS)
- echo " 🔄 falling back to curl for $(basename "$src")..."
+ # Fallback: use aws s3api put-object (single PUT, no multipart chunking)
+ echo " 🔄 falling back to s3api put-object for $(basename "$src")..."
for attempt in 1 2 3; do
- PRESIGNED=$(AWS_MAX_ATTEMPTS=2 aws s3 presign "$dst" --endpoint-url "$R2_ENDPOINT" --expires-in 3600 2>/dev/null)
- if [ -n "$PRESIGNED" ] && curl --retry 3 --retry-delay 5 --connect-timeout 30 --max-time 300 -sf -T "$src" "$PRESIGNED" 2>&1; then
- echo " ✅ $(basename "$src") (curl)"
+ if aws s3api put-object \
+ --endpoint-url "$R2_ENDPOINT" \
+ --bucket screenpipe-releases \
+ --key "$r2_key" \
+ --body "$src" \
+ --cli-read-timeout 600 --cli-connect-timeout 30 2>&1; then
+ echo " ✅ $(basename "$src") (s3api)"
return 0
fi
- echo " ⚠️ curl attempt $attempt failed for $(basename "$src")"
+ echo " ⚠️ s3api attempt $attempt failed for $(basename "$src")"
sleep $((attempt * 10))
done
echo " ❌ failed to upload $(basename "$src") after all attempts"