Subchapter 3.6
references/troubleshooting.mdMarkdown16 KBView on GitHub
Use this reference when setup, build, deploy, env, or runtime behavior fails.
Run:
bunx @prisma/cli@latest --help
bunx @prisma/cli@latest app deploy --help
bunx @prisma/cli@latest auth whoami
bunx @prisma/cli@latest auth workspace list --jsonThen inspect:
pwd
cat package.json
find .. -maxdepth 3 \( -name 'prisma.compute.ts' -o -name 'prisma.compute.mts' -o -name 'prisma.compute.js' -o -name 'prisma.compute.mjs' -o -name 'prisma.compute.cjs' \) -print
test -f .env && sed -n 's/=.*/=<redacted>/p' .envDo not print unredacted secrets.
This only matters when the project is supposed to use a config-backed deploy. A simple app without prisma.compute.ts can still deploy with explicit app deploy flags.
Symptoms:
api is not recognized.prisma/ directoryCheck:
pwd
find .. -maxdepth 4 \( -name 'prisma.compute.ts' -o -name 'prisma.compute.mts' -o -name 'prisma.compute.js' -o -name 'prisma.compute.mjs' -o -name 'prisma.compute.cjs' \) -print
bunx @prisma/cli@latest app deploy --helpFix:
[app] targets from the apps keys, such as bunx @prisma/cli@latest app deploy apiroot and env.file resolve from the config file directorySymptoms:
COMPUTE_CONFIG_INVALIDCOMPUTE_CONFIG_TARGET_REQUIREDCOMPUTE_CONFIG_TARGET_UNKNOWNFix:
defineComputeConfig({ app: ... }) or defineComputeConfig({ apps: ... })app or appsapp build webapps key for multi-app deploys, such as app deploy apinuxt, astro, and nestjs, prefer strategy defaults unless a custom build override is intentional; current configs allow the overrideframework: "custom", set both build.outputDirectory and build.entrypointbuild.outputDirectory is set for a configurable framework, also set build.entrypoint if the framework needs a configured runtime entrypointMinimal recovery config:
import { defineComputeConfig } from "@prisma/compute-sdk/config";
export default defineComputeConfig({
app: {
framework: "hono",
entry: "src/index.ts",
httpPort: 8080,
},
});--yes skips prompts and does not opt into deploy. Pass --deploy explicitly:
bunx create-prisma@latest --name my-api --template hono --provider postgresql --deployIf the integrated deploy cannot complete, scaffold succeeds but deploy should be reported as failed.
With PostgreSQL, no --database-url, and no --no-prisma-postgres, setup can provision Prisma Postgres. For local smoke tests, pass:
--no-prisma-postgres --database-url "postgresql://USER:PASSWORD@HOST:PORT/DB"Use a disposable real database URL if Prisma commands need to run.
Symptoms:
project list failsauth whoami failsPRISMA_SERVICE_TOKEN is missing, empty, expired, or lacks workspace/project permissionsFix:
bunx @prisma/cli@latest auth login
bunx @prisma/cli@latest auth whoami
bunx @prisma/cli@latest auth workspace list --jsonIf multiple local OAuth workspaces exist, switch explicitly. Prefer ids from JSON:
bunx @prisma/cli@latest auth workspace use <workspace-id>
bunx @prisma/cli@latest auth whoami --json
bunx @prisma/cli@latest project list --jsonFor a human terminal, auth workspace use with no argument opens an interactive picker or selects the only local OAuth workspace without prompting. In non-interactive or --json mode, use auth workspace use <id-or-name> instead.
If the active workspace was logged out or its token refresh failed, the CLI intentionally stays signed out for OAuth commands rather than falling through to another cached workspace. Recover by running auth workspace list --json and then auth workspace use <workspace-id>.
To remove only one local OAuth workspace session:
bunx @prisma/cli@latest auth workspace logout <workspace-id-or-name>
# or:
bunx @prisma/cli@latest auth logout --workspace <workspace-id-or-name>Use plain auth logout only when you want to clear all local OAuth workspace sessions.
For CI, @prisma/cli can authenticate with PRISMA_SERVICE_TOKEN:
test -n "${PRISMA_SERVICE_TOKEN:-}" && echo "PRISMA_SERVICE_TOKEN is set"
bunx @prisma/cli@latest auth whoami
bunx @prisma/cli@latest app deploy --json --no-interactive --prod --yes --env .envIf PRISMA_SERVICE_TOKEN is set and non-empty, it is the active auth source and local OAuth workspace switching is unavailable for command execution. Unset PRISMA_SERVICE_TOKEN before using auth workspace use to change local OAuth workspace context.
If PRISMA_SERVICE_TOKEN is set but empty, the CLI errors before trying browser-login credentials. Unset it or provide a valid workspace service token. Never echo, log, or paste the token value; only check whether it is present.
Local storage hints for debugging:
PRISMA_COMPUTE_AUTH_FILE when isolating tests.~/Library/Application Support/prisma/auth.json.~/Library/Application Support/prisma/auth.context.json..prisma/local.json..prisma/cli/state.json, usually next to the discovered prisma.compute.ts.Do not print credential files or token values into logs.
Symptoms:
PROJECT_SETUP_REQUIREDFix:
bunx @prisma/cli@latest app deploy --project <id-or-name> --json --no-interactive
bunx @prisma/cli@latest app deploy --create-project <name> --yesDo not rely on --yes alone to choose Project scope. --project, --create-project, and PRISMA_PROJECT_ID are mutually exclusive.
Symptoms:
DATABASE_URL is requiredFix:
DATABASE_URL in .env or project env.prisma generate.db:migrate or production migration command.--env .env or project env configured.If Prisma Client generation or runtime env loading is the concrete failure, then inspect Prisma-specific config:
test -f prisma.config.ts && sed -n '1,160p' prisma.config.ts
test -f prisma/schema.prisma && sed -n '1,220p' prisma/schema.prismaNever deploy postgresql://USER:PASSWORD@HOST:PORT/DATABASE placeholder values.
Symptoms:
DATABASE_URLCheck:
bunx @prisma/cli@latest project show --json
bunx @prisma/cli@latest project env list --role production --json
bunx @prisma/cli@latest project env list --role preview --json
bunx @prisma/cli@latest project env list --branch feature/foo --json
bunx @prisma/cli@latest app list-deploys --json
bunx @prisma/cli@latest app logs --deployment <deployment-id> --jsonFix:
--branch <git-name> to app deploy, database create, and branch-specific project env commands--role production for production env and --role preview for preview-template envapp logs --deployment <deployment-id>app show, app list-deploys, and app logs do not filter by branch; capture and use the deployment idapp promote <deployment-id> as a production action because it rebuilds with production env varsprisma.compute.ts to select Project, Branch, production, or database scope; it only supplies app deploy defaultsSymptoms:
DATABASE_URLFix:
app-deploy-cli.md Database and Env for the database/env guardrailsWhen the installed CLI returns PLAN_LIMIT_REACHED, treat it as a workspace plan restriction rather than a Compute or database outage.
For agent/CI handling, run the relevant database command with --json and branch on error.code === "PLAN_LIMIT_REACHED". Read error.meta.upgradeUrl, planName, workspaceId, and usageBlocked; optional values may be null. This is a workspace plan restriction rather than a Compute/database outage. Use the canonical upgrade URL when returned or direct the user to Prisma Console. Do not retry as an outage or infer a plan limit from status codes or message text.
Error shape:
Next.js build did not produce standalone outputFix next.config.ts:
const nextConfig = {
output: "standalone",
}
export default nextConfigThen reinstall/build if needed and deploy again.
Symptoms in pnpm/Bun isolated workspaces can include a deployment that builds successfully but exits before useful runtime logs, often with Cannot find module for styled-jsx or another traced dependency.
The current Compute SDK preserves in-artifact package-store symlinks and materializes only safe out-of-tree targets when staging Next standalone output. Do not manually flatten or rewrite .next/standalone/node_modules symlinks; that can break the isolated-store layout.
Fix:
@prisma/compute-sdk and @prisma/cli to current versions.output: "standalone", redeploy, and inspect the new deployment logs.@prisma/cli feedback without secrets.Nuxt or TanStack Start error shape:
.output/server/index.mjsGeneral fix:
For TanStack Start specifically:
nitro in dependenciesimport { nitro } from "nitro/vite" in vite.config.tsplugins: [tanstackStart(), nitro(), viteReact()] or the framework-equivalent plugin orderbun run build and verify .output/server/index.mjs existsvite previewCompute detection selects TanStack Start when it sees @tanstack/react-start or @tanstack/solid-start. If the Nitro entrypoint is missing after that, fix the TanStack/Nitro build output; do not assume Compute will silently use a Bun deployment.
Error shape:
Entrypoint is required
Entrypoint file does not existFix either:
{
"main": "src/index.ts"
}or deploy with:
bunx @prisma/cli@latest app deploy --framework bun --entry src/index.tsSymptoms:
Fix:
process.env.PORT--http-port <port> when the app has a fixed portcompute:deploy script when it exists@prisma/cli app deploy default is HTTP 3000; generated Hono/Elysia projects usually configure 8080 through prisma.compute.ts or flag-backed --http-port 8080 scripts8080, Next/TanStack/Nuxt 3000, Astro 4321Symptoms:
app show or deploy output has a URLCheck:
curl -i https://<deployment-url>
curl -i https://<deployment-url>/health
bunx @prisma/cli@latest app logs --jsonFix by following the first concrete failure:
localhost or 127.0.0.1Symptoms:
localhost or 127.0.0.1app run works locally, but the deployed app cannot receive external trafficWhy this happens:
Compute’s boot watcher polls /proc/net/tcp and /proc/net/tcp6 for configured ports entering LISTEN. That readiness signal tracks the port, not whether the app bound 127.0.0.1 or all interfaces. A loopback-only listener can therefore look ready while public ingress still cannot reach it.
Fix:
localhost or 127.0.0.1 server host settings0.0.0.0 or the framework equivalent, such as Astro server.host: trueHOSTNAME=localhost; use HOSTNAME=0.0.0.0 if the host is overridden0.0.0.0:<deployed-http-port>Generated compute:deploy scripts redeploy using the generated flags and/or prisma.compute.ts; they do not run migrations or seed data.
After env changes:
bunx @prisma/cli@latest project env list
bunx @prisma/cli@latest project env list --branch feature/foo
bunx @prisma/cli@latest app deploy --prod --yes --env .env
bunx @prisma/cli@latest app deploy --branch feature/foo --env .env.previewIf using branch-specific env, confirm the branch name and role.
Runtime logs for the current app:
bunx @prisma/cli@latest app logsSpecific deployment:
bunx @prisma/cli@latest app logs --deployment <deployment-id>Machine-readable:
bunx @prisma/cli@latest app logs --jsonBuild logs for GitHub/Console builds:
bunx @prisma/cli@latest build logs <build-id>
bunx @prisma/cli@latest build logs <build-id> --follow
bunx @prisma/cli@latest build logs <build-id> --jsonUse build logs for build output keyed by a Build id from a GitHub check run, Console build page, or Management API build record. Use app logs for runtime logs keyed by the current app deployment or a deployment id.
Summarize relevant errors. Do not paste secrets.
When a CLI failure survives the checks above, or a command crashes with UNEXPECTED_ERROR, report it to the Prisma team:
bunx @prisma/cli@latest feedback "app deploy crashed: <first error line>"Prefer the pre-filled command from a --json crash envelope’s nextActions verbatim. Anonymous; never put secrets, connection URLs, or tokens in the message.