> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superblocks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Size and time limits

export const Alert = ({type, title, children}) => {
  const getIcon = () => {
    switch (type) {
      case 'info':
        return "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0zm0 15c-.552 0-1-.448-1-1s.448-1 1-1 1 .448 1 1-.448 1-1 1zm1-3H9V6h2v6z' fill='%230099FF'/%3E%3C/svg%3E";
      case 'success':
        return "data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0zm4.293 6.293L9 11.586 5.707 8.293c-.391-.391-1.024-.391-1.414 0s-.391 1.024 0 1.414l4 4c.391.391 1.024.391 1.414 0l6-6c.391-.391.391-1.024 0-1.414s-1.024-.391-1.414 0z' fill='%230CC26D'/%3E%3C/svg%3E";
      case 'warning':
        return "data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHhtbDpzcGFjZT0ncHJlc2VydmUnIHdpZHRoPScxMDgwJyBoZWlnaHQ9JzEwODAnPjxyZWN0IHdpZHRoPScxMDAlJyBoZWlnaHQ9JzEwMCUnIGZpbGw9J3RyYW5zcGFyZW50Jy8+PHBhdGggZD0nTTEzLjc5NCAxMC43NSA4LjMgMS4yNWExLjUgMS41IDAgMCAwLTIuNiAwbC01LjQ5NCA5LjVBMS40OTQgMS40OTQgMCAwIDAgMS41IDEzaDExYTEuNDkzIDEuNDkzIDAgMCAwIDEuMjk0LTIuMjVNNi41IDUuNWEuNS41IDAgMCAxIDEgMFY4YS41LjUgMCAwIDEtMSAwek03IDExYS43NS43NSAwIDEgMSAwLTEuNS43NS43NSAwIDAgMSAwIDEuNScgc3R5bGU9J3N0cm9rZTpub25lO3N0cm9rZS13aWR0aDoxO3N0cm9rZS1kYXNoYXJyYXk6bm9uZTtzdHJva2UtbGluZWNhcDpidXR0O3N0cm9rZS1kYXNob2Zmc2V0OjA7c3Ryb2tlLWxpbmVqb2luOm1pdGVyO3N0cm9rZS1taXRlcmxpbWl0OjQ7ZmlsbDojZmY5ZjM1O2ZpbGwtcnVsZTpub256ZXJvO29wYWNpdHk6MScgdHJhbnNmb3JtPSd0cmFuc2xhdGUoLjAyIDE5LjMwNSlzY2FsZSg3Ny4xNCknLz48L3N2Zz4=";
      case 'danger':
        return "data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0zm5.707 4.293L10 9.586 4.293 4.293c-.391-.391-1.024-.391-1.414 0s-.391 1.024 0 1.414L8.586 11l-5.707 5.293c-.391.391-.391 1.024 0 1.414s1.024.391 1.414 0L10 12.414l5.707 5.293c.391.391 1.024.391 1.414 0s.391-1.024 0-1.414L11.414 11l5.707-5.293c.391-.391.391-1.024 0-1.414s-1.024-.391-1.414 0z' fill='%23F45252'/%3E%3C/svg%3E";
      case 'note':
        return "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0zm0 15c-.552 0-1-.448-1-1s.448-1 1-1 1 .448 1 1-.448 1-1 1zm1-3H9V6h2v6z' fill='%230099FF'/%3E%3C/svg%3E";
      default:
        return "";
    }
  };
  return <div className={`alert alert--${type}`}>
      <div className="alert-icon" style={{
    backgroundImage: `url("${getIcon()}")`,
    backgroundRepeat: 'no-repeat',
    backgroundPosition: 'center center',
    backgroundSize: '20px',
    width: '24px',
    height: '24px',
    position: 'absolute',
    left: '16px',
    top: '16px'
  }} />
      <div className="alert-content">
        {title && <div className="alert-title">{title}</div>}
        <div className="alert-body">{children}</div>
      </div>
    </div>;
};

<Alert type="info">
  <p>
    These are default settings that can be adjusted as needed. Contact Superblocks Support via email or in-app chat for assistance.
  </p>
</Alert>

## gRPC message size limits

The agent implements a gRPC interface with default limits on incoming and outgoing messages. These limits are governed by the following environment variables.

| Environment Variable                        | Description                                                                          | Default            |
| ------------------------------------------- | ------------------------------------------------------------------------------------ | ------------------ |
| `SUPERBLOCKS_ORCHESTRATOR_GRPC_MSG_REQ_MAX` | The maximum message size in bytes allowed to be received by the agent's gRPC server. | 30000000 (30 MB)   |
| `SUPERBLOCKS_ORCHESTRATOR_GRPC_MSG_RES_MAX` | The maximum message size in bytes allowed to be sent by the agent's gRPC server.     | 100000000 (100 MB) |

API steps that exceed these limits will return the following errors.

```
grpc: received message larger than max (<SIZE> vs. <LIMIT>)
```

<br />

```
grpc: sent message larger than max (<SIZE> vs. <LIMIT>)
```

To adjust these limits for handling larger messages, edit the environment variables directly or use the deployment specific methods below.

<Tabs>
  <Tab title="Terraform">
    Update your `main.tf` with the following variables set to the desired limits.

    ```
    superblocks_grpc_msg_req_max = "<SIZE_IN_BYTES>"
    superblocks_grpc_msg_res_max = "<SIZE_IN_BYTES>"
    ```
  </Tab>

  <Tab title="Helm">
    Update your Helm chart with the following variables set to the desired limits.

    ```yaml theme={null}
    grpc:
      maxRecvMsgSize: <SIZE_IN_BYTES>
      maxMsgSize: <SIZE_IN_BYTES>
    ```
  </Tab>
</Tabs>

## Node.js process memory limits

One of the main processes running in the agent is a Node.js worker responsible for executing API steps for integrations and custom backend JavaScript. As such, the [limits that exist in the Node.js V8 engine](https://blog.appsignal.com/2021/12/08/nodejs-memory-limits-what-you-should-know.html) also apply to the agent. One such limit is the [max memory size of V8's old memory section](https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-mib). When this limit is hit, the agent logs show the following error.

```
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
```

To remedy this, you can increase the heap size in the agent's Node.js worker by adding an environment variable called `NODE_OPTIONS` with a value of `--max-old-space-size=<SIZE_IN_MiB>`.  Configure this environment variable directly or use the deployment specific settings below.

<Tabs>
  <Tab title="Terraform">
    Add the environment variable with the `superblocks_agent_environment_variables`  array in your `main.tf`.

    ```
    superblocks_agent_environment_variables = [{name = "NODE_OPTIONS", value = "--max-old-space-size=<SIZE_IN_MiB>"}]
    ```
  </Tab>

  <Tab title="Helm">
    Add the environment variable to your Helm chart with the `extraEnv` config.

    ```yaml theme={null}
    extraEnv:
      NODE_OPTIONS: --max-old-space-size=<SIZE_IN_MiB>
    ```
  </Tab>

  <Tab title="Docker Compose">
    The agent's [Docker Compose file](https://github.com/superblocksteam/agent/blob/main/compose.yaml#L14) already sets the heap size limit to 3000 MiB by default. To modify this, set `SUPERBLOCKS_AGENT_MEMORY_LIMIT` to the desired limit.

    ```
    export SUPERBLOCKS_AGENT_MEMORY_LIMIT="<SIZE_IN_MiB>"
    ```
  </Tab>
</Tabs>

## REST API response size limit

When using the REST API integration, the size of the http response cannot exceed 50,000,000 bytes (50 MB) by default. This can be configured with the
`SUPERBLOCKS_WORKER_EXECUTION_REST_API_MAX_CONTENT_LENGTH_BYTES` environment variable. To increase this max size, edit the environment variable directly or use the deployment specific methods below.

<Tabs>
  <Tab title="Terraform">
    Add the environment variable with the `superblocks_agent_environment_variables`  array in your `main.tf`.

    ```
    superblocks_agent_environment_variables = [{name = "SUPERBLOCKS_WORKER_EXECUTION_REST_API_MAX_CONTENT_LENGTH_BYTES", value = "<SIZE_IN_BYTES>"}]
    ```
  </Tab>

  <Tab title="Helm">
    Add the environment variable to your Helm chart with the `extraEnv` config.

    ```yaml theme={null}
    extraEnv:
      SUPERBLOCKS_WORKER_EXECUTION_REST_API_MAX_CONTENT_LENGTH_BYTES: <SIZE_IN_BYTES>
    ```
  </Tab>
</Tabs>

## API timeout limit

APIs have a default max duration of 600,000 ms (10 minutes). This can be configured with the`SUPERBLOCKS_ORCHESTRATOR_QUOTAS_DEFAULT_API_TIMEOUT` environment variable in ms. To increase this max duration, edit the environment variable directly or use the deployment specific methods below.

<Tabs>
  <Tab title="Terraform">
    Update your `main.tf` with the following variables set to the desired limits.

    ```
    superblocks_agent_quotas_default_api_timeout = "<TIME_IN_MS>"
    ```
  </Tab>

  <Tab title="Helm">
    Add the environment variable to your Helm chart with the `extraEnv` config.

    ```yaml theme={null}
    extraEnv:
      SUPERBLOCKS_ORCHESTRATOR_QUOTAS_DEFAULT_API_TIMEOUT: <TIME_IN_MS>
    ```
  </Tab>
</Tabs>
