express-request-proxy icon indicating copy to clipboard operation
express-request-proxy copied to clipboard

API call timeout

Open cscan opened this issue 7 years ago • 7 comments

I always experienced this:

Error: API call timed out at Function.Error.create (/root/proxy/node_modules/simple-errors/index.js:25:11) at Function.Error.http (/root/proxy/node_modules/simple-errors/index.js:68:21) at unhandledApiError (/root/proxy/node_modules/express-request-proxy/lib/proxy.js:254:25) at Request. (/root/proxy/node_modules/express-request-proxy/lib/proxy.js:86:7) at emitOne (events.js:121:20) at Request.emit (events.js:211:7) at Timeout._onTimeout (/root/proxy/node_modules/request/request.js:848:16) at ontimeout (timers.js:498:11) at tryOnTimeout (timers.js:323:5) at Timer.listOnTimeout (timers.js:290:5)

I found that it caches the incomplete result even it is timeout. How to avoid that?

cscan avatar Jun 13 '18 03:06 cscan

Did you change the timeout option in the middleware ?
It defaults to 5000 ms, it might be short in some cases.

lionep avatar Jul 09 '18 13:07 lionep

having a similar issue for streaming a .mp4 video with timeout set to 10000

Error: API call timed out at Function.Error.create (.../node_modules/simple-errors/index.js:25:11) at Function.Error.http .../node_modules/simple-errors/index.js:68:21) at unhandledApiError (.../node_modules/express-request-proxy/lib/proxy.js:254:25) at Request. (.../node_modules/express-request-proxy/lib/proxy.js:86:7) at emitOne (events.js:121:20) at Request.emit (events.js:211:7) at ClientRequest. (.../node_modules/request/request.js:815:16) at Object.onceWrapper (events.js:313:30) at emitNone (events.js:106:13) at ClientRequest.emit (events.js:208:7) at Socket.emitTimeout (_http_client.js:706:34) at Object.onceWrapper (events.js:313:30) at emitNone (events.js:106:13) at Socket.emit (events.js:208:7) at Socket._onTimeout (net.js:410:8) at ontimeout (timers.js:498:11)

ttraenkler avatar Aug 19 '18 15:08 ttraenkler

I have the same problem when try to proxy request with body. The same request without body works well.

kborisevich avatar Nov 05 '18 11:11 kborisevich

It is not a clue but may be it will help somebody. Solution for me was to change content-type from 'application/json' to 'text/plain'. Direct request with content type 'application/json' works well.

kborisevich avatar Nov 05 '18 13:11 kborisevich

This is also an issue for me. I'm using .all, and curiously the issue does not occur on GET requests but does occur on PUT and POST requests.

dylanjt avatar Jan 18 '19 00:01 dylanjt

Hi all - for me, the issue was something with bodyParser. Moving my app.use for bodyParser and jsonParser until after the app.alls for the proxy solved the issue.

dylanjt avatar Jan 18 '19 01:01 dylanjt

It is not a clue but may be it will help somebody. Solution for me was to change content-type from 'application/json' to 'text/plain'. Direct request with content type 'application/json' works well.

This worked for me

edgarhurtado27 avatar Jan 02 '20 23:01 edgarhurtado27