SAP BTP requires no introduction, being well-established among SAP developers and consultants. In this brief discussion, we'll address an issue encountered within SAP APIM (API Management), a component of the SAP BTP Integration Suite, which may result in intermittent errors such as 'broken pipe error' or 'gateway timeout.
You're utilizing APIM on your BTP instance to expose the Integration Flow Endpoint as an API and test the flow. This API initiates an HTTP request to a third-party system, awaits a response for processing, and then forwards the response message to the client.
Upon triggering the API's endpoint via, for example, the Postman client, you may encounter a 'gateway timeout' error if the HTTP call to the external system exceeds or equals 55 seconds.
To illustrate, let's use an API that triggers a simple iflow, including a Groovy script step simulating an HTTP call lasting for 55 seconds.
Upon triggering the exposed API endpoint, a 'Gateway timeout' error occurs after 55 seconds.
Adjusting the timeout value to 54 seconds results in a successful API trigger with a 200 response code, indicating successful processing and response retrieval.
The default timeout value in SAP APIM is set to 55 seconds, intended to accommodate request, response, and processing times. Exceeding this threshold may result in timeout errors, including the 'broken pipe error'.
Basically it's not recommended to have timeout value of more than 55sec for a proxy. 55 seconds has been set as the default IO timeout so that if there is no data to read or if the socket is not ready to write data within 55 seconds, the transaction is treated as a timeout.
PDF version of SAP Note 3336835 - Custom timeout at API Management level
To address this issue, you may consider options such as:
- Requesting an increase in the timeout limit to 5 minutes through an OSS message to SAP
- Optimizing HTTP requests to reduce processing time and enhance efficiency.
- Redesigning your flow implementing the asynchronous call as per description from the SAP Note SAP Note 3336835 - Custom timeout at API Management level