Heroku H12 Request Timeout Error
Quick answer
H12 means a request took more than 30 seconds to start returning data. The limit cannot be raised, so move slow work to a background job and speed up the request.
Most likely fix: Move long work to a background job
How to fix it
Try these in order — the most common fix is first.
1. Move long work to a background job
- Add a worker process type to the Procfile (for example worker: bundle exec sidekiq)
- Enqueue the job in the request, respond right away, let the client poll
- Scale it: heroku ps:scale worker=1
Did this fix it?2. Add an app-level timeout below 30 seconds
- Set a service timeout of 10-15 seconds (rack-timeout for Ruby, Unicorn timeout 15, or your framework's equivalent)
- This turns hung requests into traceable errors instead of silent H12s
Did this fix it?3. Put timeouts on every outbound call
- Set connect and read timeouts on HTTP clients
- Or call the third party from a background job
Did this fix it?4. Find the slow request
- Run heroku logs --tail and grep for H12 to see the path
- Use an APM add-on such as New Relic and look at p99 service time and queue time
- Check slow queries on Heroku Postgres
Did this fix it?5. Reduce queueing
- Run more processes per dyno (for example more Puma/Unicorn workers)
- Speed up slow endpoints
- Add dynos: heroku ps:scale web=2 (needs Standard or higher for multiple dynos with autoscaling)
Did this fix it?6. Upload big files directly to S3
- Use a presigned S3 upload from the browser instead of posting through the dyno
Did this fix it?
Symptoms
Heroku logs show code=H12 desc="Request timeout"; users see an Application error page after about 30 seconds.
Why it happens
- Slow database queries or N+1 queries
- Calls to slow external APIs with no timeout
- Heavy work (PDF, images, exports, scraping) done inside the request
- Requests queued behind slow ones in a single-threaded process
- Large uploads going through the dyno
This guide also covers
- heroku h12 request timeout
- heroku request timeout 30 seconds
- heroku h12 error fix
- heroku 503 request timeout
Still not working?
If Heroku keeps failing, you're not alone. See every Heroku 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 us