Also available: Markdown version · llms.txt · full site content
Functions
Storage event functions
Run a CubiBase Function when an object is created, updated or deleted in a bucket you choose. Events come from the existing Storage event stream — only successfully completed operations emit them.
Configure a trigger
In the function editor open Triggers → Add trigger → Storage events. Pick the bucket, the lifecycle events, and optionally an object-key prefix filter.
{
"kind": "storage",
"config": {
"bucket": "images",
"events": ["storage.object.created"],
"prefix": "uploads/"
}
}| Event | Fires when |
|---|---|
storage.object.created | An upload was verified and finalized |
storage.object.updated | An existing path was replaced (explicit overwrite) |
storage.object.deleted | An object was deleted |
- A failed, abandoned or expired upload never emits an event.
- The payload carries bucket, object id, path, size, MIME type, actor and timestamp — never file contents.
- Read and write files through ctx.storage; every function write counts toward the same storage and bandwidth quotas and emits its own events.
Process an upload
export default async function handler(request: any, ctx: any) {
const event = request.event; // storage.object.created, schemaVersion 1
console.log('New object:', event.path, event.sizeBytes, 'bytes');
const source = await ctx.storage.from(event.bucketName).download(event.path);
// ...transform source.body (a Buffer) here...
// Write derivatives to a DIFFERENT prefix so this function does not
// re-trigger itself. Function writes count toward the same quotas.
await ctx.storage.from(event.bucketName).upload(
event.path.replace(/^uploads\//, 'processed/'),
source.body,
{ mimeType: source.mimeType, overwrite: true },
);
return { processed: event.path };
}Delivery semantics
The same durable queue as database events: at-least-once delivery, dedupe on eventId, exponential-backoff retries, dead-letter state after exhaustion. The event contract is shared with the Storage events documentation.