api timeout custom error response

Hi,

1. we are trying to set up a generic API timeout for all our proxies.

2. it seems that the exception happens outside/after the proxy post flow hooks. (this is where we have our generic error handling)

is this correct?

if so, in what part of the proxy execution I can update this json response. it seems it always executes after our error handling. 😞

1 6 830
6 REPLIES 6

There are two timeouts here - the timeout on the Message Processor->Backend connection, and the timeout on the Router->Message Processor connection. I think custom handling of the MP->Backend connection timeout is possible, but the Router->MP connection is not.

One common problem can occur when the MP->Backend timeout is higher than the Router->MP timeout. If you've changed the default timeout(s) you should confirm that the Router->MP timeout is still higher than the MP->Backend timeout.

hi this is unfortunate, is there another way to handle api timeout as api level? so my error handling (custom error handling) can deal with the exception messaging?

my clients cant handle 2 formats of error codes.

So long as you ensure the Router -> Message processor timeout is configured to be longer than the MP -> backend timeout, you will only get Router -> MP timeouts (the ones you can't handle) in the relatively rare situations in which the MP fails to time out (eg, if there's a bug) or if the service itself has issues (runs out of CPU, memory, hangs, etc). Both timeouts are configurable, so the key takeaway is to ensure that the R -> MP timeout is always higher than the MP -> backend timeout.

so there is 1 default now that it works (the 55 seconds default) where is that configured? virtual host ?

that default that is 55 seconds already works, and my custom error handling in hooks intercepts it.

my thought is: if that default 55 is changed to let say 10 seconds. because its a central place all my conditions will met with 1 single change

I dont want to change all apis, all service callouts, and all target backends to make this.

thoughts?

The MP->backend timeout is normally done on a per-target basis (see https://docs.apigee.com/api-platform/reference/endpoint-properties-reference and the io.timeout.millis property). IIRC changing the default to a different value is possible via CwC for private cloud customers, but I'd generally recommend against this.


@cjking wrote:

I think custom handling of the MP->Backend connection timeout is possible


Can you share how this is done? We'd like to customize the response message from what the default is below. Screen Shot 2022-10-12 at 11.56.55 AM.png