Error Encyclopedia

Fetch response body exceeds the configured limit

Angular produces this error when HttpClient uses the fetch backend during server-side rendering and the bytes buffered for a response body exceed the configured maxResponseBodySize limit. By default, Angular limits each buffered response body to 1 MB to prevent the server from buffering unexpectedly large responses during rendering.

Fixing the error

Set maxResponseBodySize in the provideServerRendering options to increase the limit:

import {provideServerRendering, withRoutes} from '@angular/ssr';
import {serverRoutes} from './app.routes.server';

const serverConfig: ApplicationConfig = {
  providers: [
    provideServerRendering(
      {
        maxResponseBodySize: 5 * 1024 * 1024, // 5MB
      },
      withRoutes(serverRoutes),
    ),
  ],
};

maxResponseBodySize configures the maximum number of response body bytes Angular buffers for each server-side HttpClient request that uses the fetch backend. The value is configured in bytes and applies globally.

IMPORTANT: Keep this limit as small as your application allows. Increasing it lets server-side requests buffer larger response bodies, which can increase memory use and denial-of-service risk. Prefer moving large downloads outside server rendering.

Debugging the error

The error message includes the configured maxResponseBodySize limit in bytes. To identify which HTTP request is returning a large response, check your network logs or the SSR server console for the failing request URL.

If the large response is only needed on the client and not required for server-side rendering, you can disable the transfer cache for that specific request:

httpClient.get('/api/large-data', {transferCache: false});