http-delayed-response icon indicating copy to clipboard operation
http-delayed-response copied to clipboard

Still receiving an H12 on Heroku.

Open jaycetan opened this issue 8 years ago • 3 comments

Hello extraBacon, Thank you for this library.

Your documentation indicates that this can be used for my exact use case. I have a Node server on Heroku in which sometimes requests can take anywhere from 3 seconds to 4.5 minutes.

I am applying this library to one of my routes but Heroku is still providing an H12 error. I don't see any additional errors in Node. Can you please tell me how I can correct my approach?

Below is my code to use the library on my submit route.

const submitController = require('./app/controllers/submitController.js');
const DelayedResponse = require('http-delayed-response');

app.post('/submit', (req, res, next) => {
  function slowfunction() {
    return submitController(req, res, next);
  }
  const delayed = new DelayedResponse(req, res, next);
  slowfunction(delayed.start(20 * 1000, 20 * 1000));
});

at=error code=H12 desc="Request timeout" method=POST path="/submit" host=test.herokuapp.com request_id=test fwd="70.165.36.139" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 protocol=https

Thanks!

jaycetan avatar Oct 13 '17 02:10 jaycetan

This module is purely experimental and I haven't used it personally in a long time. However, I see that the response has been forcefully terminated after 30 sec, but your interval + initial delay are both 20 seconds, meaning that the very first byte could be written after that 30 sec window. Try reducing the initial delay and see what happens.

extrabacon avatar Oct 13 '17 11:10 extrabacon

Hello extraBacon and jaycetan,

I am receiving Request timeout on Heroku for requests taking more than 30 second. does his code work?

naziaishrat avatar Nov 24 '18 12:11 naziaishrat

Hi, I can't seem to understand your code on npm completely

Funminiyi-debug avatar Aug 11 '20 20:08 Funminiyi-debug