Skip to content

WriteBucket

Source: src/Prisma/WriteBucket.ts

Bind a Prisma Object Store Bucket to a Prisma Compute app, AWS Lambda Function, or Cloudflare Worker with write access, and obtain the typed runtime client.

Binding creates a Prisma.BucketAccessKey for the bucket and carries its S3 credentials into the host environment, so the caller never handles a credential themselves.

Provide WriteBucketBinding on the host implementation.

Role caveat. Prisma bucket keys carry one of two coarse roles, read and read_write; there is no write-only role. This binding therefore mints a read_write key, and the credential it puts in the host environment can also read. The write-only contract is enforced client-side — WriteBucketClient exposes no read operations — and becomes a server-side boundary if Prisma grows a write-only role.

export default Prisma.Compute(
"api",
{ project, main: import.meta.filename },
Effect.gen(function* () {
const uploads = yield* Prisma.WriteBucket(bucket);
return {
fetch: Effect.gen(function* () {
yield* uploads.put("reports/2026.json", JSON.stringify({ ok: true }), {
contentType: "application/json",
});
return yield* HttpServerResponse.empty({ status: 204 });
}),
};
}).pipe(Effect.provide(Prisma.WriteBucketBinding)),
);