Skip to content
Discussions/App Development/gRPC message exceeds maximum size 4194304Forum ↗

gRPC message exceeds maximum size 4194304

App Development10 posts3,697 views2 likesLast activity May 2024
RO
RotooOP
Jun 2022

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

{
  "templateId": "DarDistribution:AcceptedDar",
  "payload": {
    "darOwner": "alice::1220f058ad95458add5a12a9b7381f53ee5135f9f36ce13217b3cf75105fa2cab8c7",
    "recipient": "alice::1220f058ad95458add5a12a9b7381f53ee5135f9f36ce13217b3cf75105fa2cab8c7",
    "hash": "1220f058ad95458add5a12a9b7381f53ee5135f9f36ce13217b3cf75105fa2cab8c7"
  }
}
{
    "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.

ST
Stephen
Jun 2022

See where package-max-inbound-message-size is set in the example JSON API configuration file; you’ll need to make a similar setting in your own config file.

RO
Rotoo
Jun 2022

Yes, I’ve already tried this.


    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
}
CO
cocreature
Jun 2022

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

RO
Rotoo
Jun 2022

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

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

Is there any alternative?

CO
cocreature
Jun 2022

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

RO
Rotoo
Jun 2022

I’m using daml start

CO
cocreature
Jun 2022

You need to change the max message size as described in Static Configuration — Daml SDK 2.2.0 documentation.

Take a look at the sandbox docs for how you can pass a config file to sandbox.

RO
Rotoo
Aug 2022

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

json-api-options: 
  - --max-inbound-message-size=9000000
WA
WallaceKelly
May 2024

The related docs have been moved and give this example:

canton.participants.participant2.ledger-api {
  address = "127.0.0.1"
  port = 5021
  max-inbound-message-size = 20971520
}
← Back to Discussions