All skills
denoland avatar

/deno-deploy

@2311d69 official
by Denodenoland/skills99 stars
8

Use when deploying Deno apps to production, asking about Deno Deploy, or working with `deno deploy` CLI commands. Covers deployment workflows, environment variables, KV database access, custom domains, the --tunnel flag for local development, and the `deno deploy` command reference.

Use this Skill: https://skilld.dev/gh/denoland/skills/deno-deploy

This session only. Nothing lands on disk.

referencesTROUBLESHOOTING.md

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

Deno Deploy Troubleshooting

First Step: Use --help

Before debugging a failed command, run --help to confirm the flags you're using actually exist and are spelled correctly:

deno deploy create --help
deno deploy env --help
deno deploy database --help

Exit code 2 almost always means a flag is missing or invalid — --help will show you exactly what's required.

Common Errors

"No organization was selected"

This error occurs because the CLI needs an organization context. Unfortunately, commands like deno deploy orgs also fail without this context.

Solution:

  1. Find your org name manually: Visit https://console.deno.com - your org is in the URL path (e.g., console.deno.com/donjo means org is donjo)

  2. Specify org explicitly:

    deno deploy --org your-org-name --prod
  3. Or create an app with org:

    deno deploy create --org your-org-name
    # Complete the browser flow when prompted

If you see this error, the user needs to provide their organization name from the console URL.

"No entrypoint found"

Specify your entry file:

deno deploy --entrypoint main.ts --prod

Or add to deno.json:

{
  "deploy": {
    "entrypoint": "main.ts"
  }
}

"authorization required"

Token expired or missing. Options:

"Minimum Deno version required"

User needs to upgrade Deno:

deno upgrade

The deno deploy command requires Deno >= 2.4.2.

Fresh "Build required" Error

Fresh 2.0 requires building before deployment:

deno task build
deno deploy --prod

Environment Variable Errors

Check what's currently set:

deno deploy env list

Add missing variables:

deno deploy env add MISSING_VAR "value"

Warmup Failure After Deploy

The build succeeds but the deploy fails with a warmup error or exit code 1. This usually means the app crashes on startup.

Most common cause: The app connects to a database at startup (e.g., await initDb() in main.ts), but no database has been provisioned or assigned yet.

Solution:

  1. Provision and assign the database:

    deno deploy database provision my-db --kind prisma --region us-east-1
    deno deploy database assign my-db --app <APP_NAME>
  2. Redeploy:

    deno deploy --prod

For a complete walkthrough, see the Fresh + PostgreSQL recipe.

Fresh Auto-Detection / Preset Fails

When the CLI auto-detects Fresh or you use --framework-preset fresh, the deploy may fail with an API error. This is a known issue.

Workaround: Use --do-not-use-detected-build-config and specify all build commands manually:

deno deploy create \
  --org <ORG_NAME> --app <APP_NAME> \
  --source local \
  --do-not-use-detected-build-config \
  --install-command "deno install" \
  --build-command "deno task build" \
  --pre-deploy-command "echo ready" \
  --runtime-mode dynamic --entrypoint main.ts \
  --build-timeout 5 --build-memory-limit 1024 --region us

Error Response Table

Error Cause Solution
"No organization was selected" No org in config Get org name from console URL, use --org flag
"No entrypoint found" Can't find main file Use --entrypoint flag or set in deno.json
"authorization required" Token expired/missing Re-authenticate or set DENO_DEPLOY_TOKEN
"Minimum Deno version required" Deno too old Run deno upgrade
Exit code 2 (usage error) Missing or invalid flags Run deno deploy create --help to see required flags
Warmup failure (exit code 1) App crashes on startup Check for missing database or env vars — see Warmup Failure
Fresh preset API error Auto-detection bug Use --do-not-use-detected-build-config — see Fresh workaround

Verifying Deployment Success

The CLI output can be verbose. Look for these indicators of success:

  • A URL containing .deno.dev or .deno.net - this is your live deployment
  • A console URL like https://console.deno.com/<org>/<app>/builds/<id>
  • The command exits with code 0 (no error)

After deployment, confirm success by extracting the production URL from the output. The format is typically: https://<app-name>.<org>.deno.net or https://<app-name>.deno.dev

Commands That Require Org Context

These commands will error if no org is configured - do not try them to "discover" orgs:

  • deno deploy (without --org flag)
  • deno deploy orgs
  • deno deploy switch
  • deno deploy env list
  • deno deploy logs

Environment Variable Contexts

Variables can apply to different environments:

# Set which contexts a variable applies to
deno deploy env update-contexts API_KEY Production Preview

Available contexts: Production, Preview, Local, Build

Source: SKILL.md on GitHub

1 warning16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides safe and standard reference guidelines and deployment documentation for the Deno Deploy CLI. It covers configuration files, environment variables, command references, and databases without introducing dangerous command scripts, malicious prompt adjustments, obfuscated paths, or external download vulnerabilities.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    9/9 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

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

Last checked against GitHub 3 days ago.

Steadyupdated 2 months ago
metadata
{
  "author": "denoland",
  "version": "1.5"
}
  • CLI
  • deno
  • deno-deploy
  • deployment
  • environment-variables
  • kv
  • custom-domains
  • production

README badge

README badge for denoland/skills/deno-deploy

Guides deployment of Deno applications to Deno Deploy using the `deno deploy` CLI (requires Deno >= 2.4.2). Covers app creation, production and preview deploys, environment variables across contexts, KV database provisioning, and the `--tunnel` flag for local development.

Generated from the current SKILL.md.

Does this skill cover the deprecated `deployctl` command?
No. This skill uses only the modern `deno deploy` command (requires Deno >= 2.4.2). The `deployctl` command is deprecated and not covered.
Can I use this skill to deploy to other platforms like Vercel or AWS Lambda?
No. This skill applies only to Deno Deploy. For other platforms, use their platform-specific guidance directly.
What should I do if my app connects to a database at startup?
Create the app with `--no-wait`, provision and assign the database with `deno deploy database` commands, then redeploy so the database exists before warmup.
Do I need to add configuration to deno.json before deploying?
Only if you have an existing app on Deno Deploy. For new apps, `deno deploy create` sets up the config automatically. For subsequent deploys, `deno deploy --prod` uses the stored org and app names.
How do I set different environment variables for production and preview deployments?
Deno Deploy supports separate contexts: Production (live traffic), Development (previews), and Build (during builds). You can set different values for the same variable in each context using the CLI.

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