Upload blobs straight to R2 with presigned URLs

Đang mở
#49 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
aws, typescript
Lĩnh vực
backend-api-design, cloud

Hướng nghiên cứu

Read the server’s blob store and publish flow, then compare the store protocol in the vite-plus and vite-task repositories; the issue does not name specific files or tests. Map how R2 signing credentials, generation reservation, direct upload, and publish verification would work across all three parts. Done means clients can upload to a presigned R2 URL and publish only after the server verifies the object.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

The idea. Let a client upload a blob straight to R2 with a presigned URL, so that the blob's bytes never pass through the Worker.

Why. Today every byte of a blob streams through the Worker. Because R2's multipart upload needs parts of at least 5 MiB, uploadBlob() buffers 5 MiB per store in flight. Isolate memory is what bounds concurrent stores (Admission, 2 per isolate), and refused stores are lost, since the client doesn't retry a 503.

With presigned uploads:

  • the Worker only reserves the generation, signs a URL for blob_object, and later publishes after checking the object's size;
  • concurrency is then bounded by the rate limit, not memory;
  • large blobs (we see up to 13 MB) cost the Worker nothing.

What it needs.

  • Server: an endpoint that reserves a generation and returns a presigned R2 PUT URL, with the size limit enforced on the signed request or checked at publish, and a publish step that verifies the object.
  • Client (vite-plus / vite-task): the store protocol has to change to send the metadata and get a URL back, then PUT the blob, then publish. So this is a protocol change across both repos, not just this one.
  • Credentials: signing needs R2 S3 API credentials as Worker secrets, which the current binding-only setup doesn't need.

A smaller step that helps today, without a protocol change, is https://github.com/voidzero-dev/vite-plus-remote-cache-cloudflare/issues/48.

Ngôn ngữ chính
TypeScript
Star
8
Fork
0
Merge trung bình
2 ngày 10 giờ
Pull request đã merge (30 ngày)
40

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của voidzero-dev/vite-plus-remote-cache-cloudflare

Tất cả issue của voidzero-dev/vite-plus-remote-cache-cloudflare

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.