clone

a daily shikaku puzzle for phones: one seeded puzzle per date, solved by dragging rectangles

main
rect.run / .github / skills / deno-deploy / references / TROUBLESHOOTING.md
TROUBLESHOOTING.md 5.0K rendered
1# Deno Deploy Troubleshooting23## First Step: Use `--help`45Before debugging a failed command, run `--help` to confirm the flags you're using actually exist and are spelled correctly:67```bash8deno deploy create --help9deno deploy env --help10deno deploy database --help11```1213Exit code 2 almost always means a flag is missing or invalid — `--help` will show you exactly what's required.1415## Common Errors1617### "No organization was selected"1819This error occurs because the CLI needs an organization context. Unfortunately, commands like `deno deploy orgs` also fail without this context.2021**Solution:**22231. **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`)24252. **Specify org explicitly:**26 ```bash27 deno deploy --org your-org-name --prod28 ```29303. **Or create an app with org:**31 ```bash32 deno deploy create --org your-org-name33 # Complete the browser flow when prompted34 ```3536If you see this error, the user needs to provide their organization name from the console URL.3738### "No entrypoint found"3940Specify your entry file:4142```bash43deno deploy --entrypoint main.ts --prod44```4546Or add to `deno.json`:4748```json49{50 "deploy": {51 "entrypoint": "main.ts"52 }53}54```5556### "authorization required"5758Token expired or missing. Options:59- Re-authenticate interactively (browser flow)60- Set up a CI/CD token via `DENO_DEPLOY_TOKEN` environment variable61- Create a new token at https://console.deno.com/account/access-tokens6263### "Minimum Deno version required"6465User needs to upgrade Deno:66```bash67deno upgrade68```6970The `deno deploy` command requires Deno >= 2.4.2.7172### Fresh "Build required" Error7374Fresh 2.0 requires building before deployment:7576```bash77deno task build78deno deploy --prod79```8081### Environment Variable Errors8283Check what's currently set:8485```bash86deno deploy env list87```8889Add missing variables:9091```bash92deno deploy env add MISSING_VAR "value"93```9495### Warmup Failure After Deploy9697The build succeeds but the deploy fails with a warmup error or exit code 1. This usually means the app crashes on startup.9899**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.100101**Solution:**1021031. Provision and assign the database:104 ```bash105 deno deploy database provision my-db --kind prisma --region us-east-1106 deno deploy database assign my-db --app <APP_NAME>107 ```1081092. Redeploy:110 ```bash111 deno deploy --prod112 ```113114For a complete walkthrough, see the [Fresh + PostgreSQL recipe](FRAMEWORKS.md#fresh--postgresql).115116### Fresh Auto-Detection / Preset Fails117118When the CLI auto-detects Fresh or you use `--framework-preset fresh`, the deploy may fail with an API error. This is a known issue.119120**Workaround:** Use `--do-not-use-detected-build-config` and specify all build commands manually:121122```bash123deno deploy create \124 --org <ORG_NAME> --app <APP_NAME> \125 --source local \126 --do-not-use-detected-build-config \127 --install-command "deno install" \128 --build-command "deno task build" \129 --pre-deploy-command "echo ready" \130 --runtime-mode dynamic --entrypoint main.ts \131 --build-timeout 5 --build-memory-limit 1024 --region us132```133134## Error Response Table135136| Error | Cause | Solution |137|-------|-------|----------|138| "No organization was selected" | No org in config | Get org name from console URL, use `--org` flag |139| "No entrypoint found" | Can't find main file | Use `--entrypoint` flag or set in deno.json |140| "authorization required" | Token expired/missing | Re-authenticate or set `DENO_DEPLOY_TOKEN` |141| "Minimum Deno version required" | Deno too old | Run `deno upgrade` |142| Exit code 2 (usage error) | Missing or invalid flags | Run `deno deploy create --help` to see required flags |143| Warmup failure (exit code 1) | App crashes on startup | Check for missing database or env vars — see [Warmup Failure](#warmup-failure-after-deploy) |144| Fresh preset API error | Auto-detection bug | Use `--do-not-use-detected-build-config` — see [Fresh workaround](#fresh-auto-detection--preset-fails) |145146## Verifying Deployment Success147148The CLI output can be verbose. Look for these indicators of success:149- A URL containing `.deno.dev` or `.deno.net` - this is your live deployment150- A console URL like `https://console.deno.com/<org>/<app>/builds/<id>`151- The command exits with code 0 (no error)152153After deployment, confirm success by extracting the production URL from the output. The format is typically:154`https://<app-name>.<org>.deno.net` or `https://<app-name>.deno.dev`155156## Commands That Require Org Context157158These commands will error if no org is configured - do not try them to "discover" orgs:159- `deno deploy` (without --org flag)160- `deno deploy orgs`161- `deno deploy switch`162- `deno deploy env list`163- `deno deploy logs`164165## Environment Variable Contexts166167Variables can apply to different environments:168169```bash170# Set which contexts a variable applies to171deno deploy env update-contexts API_KEY Production Preview172```173174Available contexts: `Production`, `Preview`, `Local`, `Build`