Expiring objects (Storage) #20171
Replies: 3 comments 5 replies
-
|
This is not an answer from Supabase, but how would setting s3 to delete an object also then delete the storage.objects info? Seems there would still need to be cron task or event to delete that from the database side. Then you have to asynchronous activities going on though. To sync them you are back to cron/event to delete both storage.objects row and s3 object. |
Beta Was this translation helpful? Give feedback.
-
|
I don't mean to hijack the post but I was also looking to create a cron to delete all files in storage that "expired" (or that are older than xx hours/days for example) |
Beta Was this translation helpful? Give feedback.
-
|
Just adding to the chorus – the ability to set an expiration using an ISO string or millisecond time would be really great when uploading objects to Storage. Something like: const avatarFile = event.target.files[0]
const { data, error } = await supabase
.storage
.from('avatars')
.upload('public/avatar1.png', avatarFile, {
cacheControl: '3600',
upsert: false,
// For an expiration, for example, using an ISO string
expiration: '2025-11-09T06:50:50.003Z',
// As a PostgreSQL timestamptz
expiration: '2025-11-09 06:50:50.00398+00',
// Or in UTC time
expiration: 1762671050003,
// Or as a future time (created_at + expires_in) in milliseconds
expires_in: 30 * 24 * 60 * 60 * 1000,
}) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When uploading a file to s3 you have the option to add lifecycles to expire the object after a set period. This API should be exposed to the storage side of supabase. This feature is critical to preventing extra crons or events to clear storage.
Beta Was this translation helpful? Give feedback.
All reactions