Skip to content

[@vercel/blob] Add ttlDays option - #1108

Open
falcoagustin wants to merge 2 commits into
mainfrom
falcoagustin/blob-ttl
Open

falcoagustin wants to merge 2 commits into
mainfrom
falcoagustin/blob-ttl

Conversation

@falcoagustin

Copy link
Copy Markdown
Collaborator

Problem

There is no way to make a blob expire. Temp uploads, exports and previews stay until someone deletes them.

Design: Blob TTL for objects. Server side: vercel/api#92860.

Solution

Adds ttlDays (integer 1 to 30) to put, copy, rename and createMultipartUpload. It is sent as the x-ttl-days header, embedded in client tokens from generateClientTokenFromReadWriteToken and handleUpload, and signed into presigned put URLs as vercel-blob-ttl-days. Browser-side upload and uploadPresigned reject it, same as cacheControlMaxAge, so only the server decides the TTL.

head() returns expiresAt as a Date when the blob has a TTL.

Why: Blob had no expiry. This lets a write say how long the object should live, and the API tags it so S3 lifecycle rules delete it. Copies and renames never inherit the source TTL, so promoting a temp upload to its final path is just a copy or rename without ttlDays.

Requires the API change to be deployed and the blob-ttl team flag to be on; otherwise the API returns 400.

🤖 Generated with Claude Code

Sent as x-ttl-days on put, copy, rename and createMultipartUpload,
embedded in client tokens and signed into presigned URLs. head()
returns expiresAt when a TTL applies.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
vercel-storage-next-integration-test-suite Ready Ready Preview Sep 19, 2026 10:58am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Sep 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b041c57

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@vercel/blob Minor
vercel-storage-integration-test-suite Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview b041c574 Deployed Sep 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant