Resolve outbound API request timeouts in AEM Publish
This article explains how to address intermittent timeout issues in Adobe Experience Manager (AEM) Publish when retrieving large datasets from external APIs, and provides strategies to avoid platform-level timeout errors.
Description description
Environment
Adobe Experience Manager (AEM) Publish (all versions, including AEM as a Cloud Service)
Symptoms
- Intermittent timeouts occur when AEM Publish retrieves large datasets (such as inventory data) from an external API.
- The external API takes longer than the platform-level timeout to return the first byte, resulting in ServiceUnavailable or first byte timeout errors.
- These timeouts cause failures in the data retrieval process.
Cause
AEM Publish enforces a platform-level timeout on outbound HTTP connections. If an external API is slow to respond, synchronous requests from AEM Publish exceeds this timeout, resulting in errors and failed data retrieval.
Resolution resolution
Follow the steps below to resolve the issue:
-
Review your HTTP client configuration in your AEM Publish code:
- Set explicit connect and read timeouts for outbound HTTP requests to external APIs. The platform enforces a global timeout (For example: 10 seconds for connection and 60 seconds for read) if your code doesn’t specify its own timeouts.
-
Optimize your integration to avoid long-running synchronous calls:
-
Batch or paginate inventory retrieval requests so that each individual API call processes a smaller subset of data and completes well within the platform timeout window.
-
For example, instead of requesting all inventory items in a single call, request smaller pages (For example: 500 or 1000 items per call) and aggregate the results, as needed.
-
-
Implement caching or precompute inventory data where possible:
- Store frequently accessed inventory data in a cache or precompute it during off-peak hours to reduce the need for repeated large API calls.
-
Move long-running inventory pulls to asynchronous processing:
- Instead of making the page request wait for the third-party API response, trigger inventory updates asynchronously (For example: via scheduled jobs or background workers) and serve cached or pre-fetched data to end users.
-
If you require a longer timeout than the platform allows, redesign the integration to avoid synchronous long-running calls. Increasing the platform-level timeout isn’t supported.
-
After making these changes, verify that inventory retrieval completes successfully and that timeout errors no longer occur.