Skip to content

ReadBucket

Source: src/Prisma/ReadBucket.ts

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

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

Provide ReadBucketBinding on the host implementation.

Prisma bucket keys carry one of two coarse roles, read and read_write. This binding mints the read one, so the credential it puts in the host environment cannot write, and ReadBucketClient exposes no write operations either.

export default Prisma.Compute(
"api",
{ project, main: import.meta.filename },
Effect.gen(function* () {
const uploads = yield* Prisma.ReadBucket(bucket);
return {
fetch: Effect.gen(function* () {
const object = yield* uploads.get("reports/2026.json");
return yield* HttpServerResponse.json(
object === null ? null : yield* object.json(),
);
}),
};
}).pipe(Effect.provide(Prisma.ReadBucketBinding)),
);