# gRPC message exceeds maximum size 4194304

**URL:** <https://forum.canton.network/t/grpc-message-exceeds-maximum-size-4194304/4701>\
**Category:** App Development\
**Created:** [June 9, 2022, 1:33pm UTC](https://forum.canton.network/t/grpc-message-exceeds-maximum-size-4194304/4701 "2022-06-09T13:33:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rotoo](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/rotoo/32/3905_2.png) [@Rotoo](https://forum.canton.network/u/Rotoo)\
**Post date:** [June 9, 2022, 1:33pm UTC](https://forum.canton.network/t/grpc-message-exceeds-maximum-size-4194304/4701/1 "2022-06-09T13:33:49Z")

</div>

Hello Damlers,

I’m trying to create a contract using the JSON api. In the project I’ve included a set of types that are relatively large resulting a 4MB dar file.

This is the result I get when trying to create a contract:

> [http://localhost:7575/v1/create](http://localhost:7575/v1/create)

```haskell
{
  "templateId": "DarDistribution:AcceptedDar",
  "payload": {
    "darOwner": "alice::1220f058ad95458add5a12a9b7381f53ee5135f9f36ce13217b3cf75105fa2cab8c7",
    "recipient": "alice::1220f058ad95458add5a12a9b7381f53ee5135f9f36ce13217b3cf75105fa2cab8c7",
    "hash": "1220f058ad95458add5a12a9b7381f53ee5135f9f36ce13217b3cf75105fa2cab8c7"
  }
}

```

```haskell
{
    "errors": [
        "RESOURCE_EXHAUSTED: gRPC message exceeds maximum size 4194304: 8575058"
    ],
    "ledgerApiError": {
        "code": 8,
        "details": [],
        "message": "gRPC message exceeds maximum size 4194304: 8575058"
    },
    "status": 429
}

```

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![Stephen](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/stephen/32/102_2.png) [@Stephen](https://forum.canton.network/u/Stephen)\
**Post date:** [June 9, 2022, 1:42pm UTC](https://forum.canton.network/t/grpc-message-exceeds-maximum-size-4194304/4701/2 "2022-06-09T13:42:50Z")

</div>

See where `package-max-inbound-message-size` is set [in the example JSON API configuration file](https://docs.daml.com/2.2.0/json-api/index.html#codecell3); you’ll need to make a similar setting in your own config file.

---

<div class="post-metadata">

**Author:** ![Rotoo](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/rotoo/32/3905_2.png) [@Rotoo](https://forum.canton.network/u/Rotoo)\
**Post date:** [June 9, 2022, 2:04pm UTC](https://forum.canton.network/t/grpc-message-exceeds-maximum-size-4194304/4701/3 "2022-06-09T14:04:58Z")

</div>

Yes, I’ve already tried this.

```haskell

    server {
        address = "localhost"
        port = 7576
    }
    ledger-api {
        address = "localhost"
        port = 6865
    }
    package-reload-interval = 10s
    max-inbound-message-size = 9194304
    package-max-inbound-message-size = 9194304
    max-template-id-cache-entries = 1000
    health-timeout-seconds = 10
}

```

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [June 9, 2022, 2:08pm UTC](https://forum.canton.network/t/grpc-message-exceeds-maximum-size-4194304/4701/4 "2022-06-09T14:08:25Z")

</div>

The error seems to come from the underlying ledger not the JSON API. So you need to increase the max inbound size there.

---

<div class="post-metadata">

**Author:** ![Rotoo](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/rotoo/32/3905_2.png) [@Rotoo](https://forum.canton.network/u/Rotoo)\
**Post date:** [June 9, 2022, 2:27pm UTC](https://forum.canton.network/t/grpc-message-exceeds-maximum-size-4194304/4701/5 "2022-06-09T14:27:50Z")

</div>

I’ve added the following command to my daml.yaml

```haskell
scenario-service:
  grpc-max-message-size: 14194304

```

Is there any alternative?

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [June 9, 2022, 2:28pm UTC](https://forum.canton.network/t/grpc-message-exceeds-maximum-size-4194304/4701/6 "2022-06-09T14:28:18Z")

</div>

That’s the scenario service not the ledger you’re running the JSON API against. Are you using `daml sandbox`?

---

<div class="post-metadata">

**Author:** ![Rotoo](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/rotoo/32/3905_2.png) [@Rotoo](https://forum.canton.network/u/Rotoo)\
**Post date:** [June 9, 2022, 2:41pm UTC](https://forum.canton.network/t/grpc-message-exceeds-maximum-size-4194304/4701/7 "2022-06-09T14:41:44Z")

</div>

I’m using _daml start_

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [June 9, 2022, 2:47pm UTC](https://forum.canton.network/t/grpc-message-exceeds-maximum-size-4194304/4701/8 "2022-06-09T14:47:08Z")

</div>

You need to change the max message size as described in [Static Configuration — Daml SDK 2.2.0 documentation](https://docs.daml.com/canton/usermanual/static_conf.html#max-inbound-message-size).

Take a look at the [sandbox docs](https://docs.daml.com/tools/sandbox.html) for how you can pass a config file to sandbox.

---

<div class="post-metadata">

**Author:** ![Rotoo](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/rotoo/32/3905_2.png) [@Rotoo](https://forum.canton.network/u/Rotoo)\
**Post date:** [August 15, 2022, 6:49pm UTC](https://forum.canton.network/t/grpc-message-exceeds-maximum-size-4194304/4701/9 "2022-08-15T18:49:28Z")

</div>

Solved the problem by adding the following lines to `daml.yaml`:

```haskell
json-api-options: 
  - --max-inbound-message-size=9000000

```

---

<div class="post-metadata">

**Author:** ![WallaceKelly](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/wallacekelly/32/5046_2.png) [@WallaceKelly](https://forum.canton.network/u/WallaceKelly)\
**Post date:** [May 22, 2024, 4:54pm UTC](https://forum.canton.network/t/grpc-message-exceeds-maximum-size-4194304/4701/10 "2024-05-22T16:54:07Z")

</div>

The [related docs have been moved](https://docs.daml.com/canton/usermanual/apis.html#max-inbound-message-size) and give this example:

```haskell
canton.participants.participant2.ledger-api {
  address = "127.0.0.1"
  port = 5021
  max-inbound-message-size = 20971520
}

```
