Index of every page on this site: llms.txt
All skills
prisma avatar

/prisma-compute

@a6f1929 official
by prismaprisma/skills80 stars
8
Run it yourself

Deploy and operate apps on Prisma Compute with the Prisma 8 CLI. Use whenever the user mentions Prisma Compute, deploying or hosting a Prisma app, `prisma deploy`, `prisma dev module.ts`, Prisma Composer apps (`module.ts`, `compute()`, the `composer` section of `prisma.config.ts`), preview stages, deploy on push (`prisma git connect`, `prisma/cloud-deploy-action`), `prisma service` logs, versions, rollback, or custom domains, `project env`, `PRISMA_SERVICE_TOKEN`, regions, 504s, sleeping instances, or `waitUntil`; also when a project still uses the removed `@prisma/cli app deploy`, `prisma.compute.ts`, `defineComputeConfig`, `compute:deploy`, or `build logs` surface.

Use this Skill: https://skilld.dev/gh/prisma/skills/prisma-compute

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesruntime-requirements.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

runtime-requirements

What a service must do to run on Prisma Compute, and the platform limits it must design around.

Priority

CRITICAL

Why It Matters

A deploy can converge cleanly and still serve nothing: a loopback listener is unreachable, a slow handler gets a 504 from the ingress, and a sleeping instance stops background work. None of these show up as deploy errors.

Runtime

  • Services run on Bun, in a VM next to their Prisma Postgres database. Write server code for Bun, and bundle with bun build --target=bun or another bundler that inlines all dependencies. A build that leaves packages as imports needs dependencies: "external" on node() (Composer 0.29.0 and later).
  • There is no global Temporal. A service that reads Prisma ORM DateTime columns as Temporal values compiles, deploys, then fails on the first read. Import a polyfill at the server entry or use string column types.

Host and Port

  • Listen on service.port() (default 3000). The runtime also exports it as PORT.
  • Bind 0.0.0.0. Compute routes external HTTP to the VM; a localhost or 127.0.0.1 listener looks started but is unreachable.
Bun.serve({ port: service.port(), hostname: "0.0.0.0", fetch: handler });

60 Seconds to First Byte

The ingress gives a request 60 seconds to start responding. If nothing comes back, the client gets 504 Gateway Time-out (a short openresty HTML body) and Compute cancels the request. Your handler sees only its abort signal (req.signal); no error is logged.

  • Respond within 60 seconds. For webhooks, return 200 or 202 before processing.
  • Keep in-request timeouts (fetch timeouts, AbortSignal.timeout) under 60 seconds so your own error handling runs first.
  • Continue longer work after the response with waitUntil, or persist a job and process it in steps from a separate trigger. Compute does not run scheduled jobs; the trigger is an external scheduler or the Composer cron module.
  • The deadline covers only the first bytes. The docs say a response that has started is not cut off; the prisma-composer-core-concepts skill warns that the ingress buffers streamed responses. Send the first bytes early and test a streaming route on a stage before relying on it.

Sleep and Keep-Awake

Idle instances scale to zero: the platform snapshots memory and resumes from it on the next request. Requests are unaffected, but setTimeout, setInterval, and floating promises can stall mid-flight. Do not build schedulers on setInterval inside a service.

@prisma/compute keeps an instance awake on a best-effort basis:

import { KeepAwakeGuard, waitUntil } from "@prisma/compute";

waitUntil(processJob(job), { signal: AbortSignal.timeout(10 * 60_000) });

async function processBatch() {
  using guard = new KeepAwakeGuard({ signal: AbortSignal.timeout(30_000) });
  await doWork();
}
  • The signal caps how long the instance stays awake; it does not cancel the work.
  • Release a manually created guard in finally with guard.release() where using is unavailable.
  • Neither primitive makes work durable, retries it, or carries it through a restart or a new deployment.

Connections

Scale to zero closes idle database connections. A long-lived client that treats a dropped connection as fatal crash-loops through 502s. Keep pools small and reconnect-friendly, and log instead of exiting:

const sql = new SQL({ url: db.url, max: 1, idleTimeout: 10 });
process.on("uncaughtException", (err) => console.error("uncaughtException", err));
process.on("unhandledRejection", (err) => console.error("unhandledRejection", err));

A call into a sleeping service can get ECONNRESET during the cold start; retry it. The generated Composer RPC client already does.

Limits

  • No WebSocket servers.
  • No persistent filesystem.
  • No multi-region deployments. Each service runs in one region, and a Composer deploy uses the project's region, fixed when the first deploy creates the project: us-east-1, us-west-1, eu-west-3, eu-central-1, ap-northeast-1, or ap-southeast-1.
  • A deployed /rpc/<method> of a Composer contract returns 401 to anything except the services wired to it. That is the service-key check, not a broken deploy.

Bad

app.post("/webhook", async (c) => {
  await processForTwoMinutes(await c.req.json());
  return c.text("done");
});

The caller gets a 504 after 60 seconds, and the instance can sleep while the work continues.

Good

app.post("/webhook", async (c) => {
  const job = await c.req.json();
  waitUntil(processForTwoMinutes(job), { signal: AbortSignal.timeout(5 * 60_000) });
  return c.body(null, 202);
});

References

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts10d3 checks · Risk SAFE
  • Gen Agent Trust Hub11d

    The skill provides comprehensive instructions for deploying and managing applications on Prisma Compute using the Prisma 8 CLI. It follows security best practices, such as redacting environment variables before display and warning against sharing secrets. All external resources and tools originate from trusted Prisma domains and repositories.

  • Socket10d

    No alerts

  • Snyk11d

    Risk: LOW · No issues

Signed by skilld at a6f1929. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 2 weeks ago
metadata
{
  "author": "prisma",
  "version": "2.1.0"
}

README badge

README badge for prisma/skills/prisma-compute

Guides agents through deploying TypeScript apps to Prisma Compute using the `@prisma/cli app deploy` command or `create-prisma` scaffolding. Covers framework-specific readiness (Next.js, Hono, Elysia, Astro, Nuxt, etc.), host/port binding, environment variables, branch deployments, and troubleshooting of the Compute CLI surface.

Generated from the current SKILL.md.

Does this skill cover deploying existing apps or only new scaffolds?
Both. It covers deploying existing TypeScript apps using the generated `compute:deploy` script or `@prisma/cli app deploy`, and scaffolding new apps with `create-prisma --deploy`. Prefer the generated script if your project already has one.
What frameworks does Prisma Compute support?
Current CLI deploy support includes Next.js, Hono, TanStack Start, and Bun. The skill covers deploy readiness checks for Elysia, Astro, Nuxt, Svelte, Nest, and Turborepo, but verify current CLI help output before deploying any framework.
Do I need to use `@prisma/cli` or the old Prisma CLI for Compute?
Use `@prisma/cli@latest` for Compute app deployment unless your help output shows the command has moved. Always verify current CLI help before assuming package names or flags.
What do I need to fix if my server won't accept connections after deploying?
Ensure your app binds to all interfaces (`0.0.0.0` or the framework equivalent) and reads the `PORT` environment variable, not hardcoded `localhost` or `127.0.0.1`. Loopback-only listeners appear ready locally but fail in production.
How do I deploy without interactive browser auth?
Use a stored CLI login or set `PRISMA_SERVICE_TOKEN` in your environment. Run with `--json --no-interactive` for agent-readable output. Never print the token.

Generated from the current SKILL.md. These answers refresh after source changes.