DigitalOcean App Platform Deploy Failed or 502 After Deploy
Quick answer
If the build succeeds but the deploy fails or the app returns 502/503, the service usually is not listening on 0.0.0.0 and the expected port (8080/PORT), fails its health check, or runs out of memory (exit code 137).
Most likely fix: Bind to the right address and port
How to fix it
Try these in order — the most common fix is first.
1. Bind to the right address and port
- Listen on 0.0.0.0 and use the PORT environment variable (default 8080)
- If you hardcode a port, set HTTP Port in the component Settings tab to match; http_port in the app spec overrides PORT
Did this fix it?2. Fix the health check
- Check the last health check result in the app
- Make sure the configured route returns a 200 quickly
Did this fix it?3. Check memory and restarts
- Open Insights and check CPU, memory and the Restart Count metric (a crash loop can hide a normal memory graph)
- Move to a larger instance size or enable autoscaling on dedicated containers
Did this fix it?4. Check env vars and database access
- Confirm required environment variables exist at runtime
- App Platform sets DATABASE_URL for attached managed databases; remove trusted-source restrictions that block it
- Use the console to open a shell in the container for debugging
Did this fix it?
Symptoms
Deployment fails with ContainerHealthChecksFailed, ContainerExitNonZero or ContainerOutOfMemory, or the live app shows 502/503.
Why it happens
- App binds to localhost or 127.0.0.1
- Hardcoded port differs from the HTTP Port setting
- Health check route returns an error or is too slow
- Container exits with non-zero code (missing env vars, crash on start)
- Container out of memory (exit code 137)
- Database restricts trusted sources so the app cannot connect
This guide also covers
- digitalocean app platform 502
- app platform health check failed
- containerhealthchecksfailed
- app platform deploy failed
Still not working?
If DigitalOcean keeps failing, you're not alone. See every DigitalOcean problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usOther DigitalOcean errors
- DigitalOcean Droplet SSH Permission Denied (publickey)
- DigitalOcean Droplet SSH Connection Refused or Timed Out
- DigitalOcean Droplet 502 Bad Gateway (Nginx)
- DigitalOcean Droplet Out of Memory (OOM Killer)
- DigitalOcean App Platform Build Failed
- DigitalOcean Account Locked or Verification Required
- DigitalOcean Unexpected Bill: Charged for Deleted or Powered-Off Droplets
- DigitalOcean Droplet Locked Out: Reset Root Password and Recovery Console