examples icon indicating copy to clipboard operation
examples copied to clipboard

Error: The replica returned an HTTP Error: Http Error: status 413 Payload Too Large

Open wisarmy opened this issue 2 years ago • 2 comments

How to solve the following problem?

project location

/examples/rust/nft-wallet (master 0bb5b834d578a26c38b096c1ebe03682d879565b)

error is

➜  nft-wallet git:(master) ✗ dfx deploy --no-wallet --argument null                                            (0s)[22-06-11 9:17:54]
Deploying all canisters.
All canisters have already been created.
Building canisters...
Executing './build.sh'
    Finished release [optimized] target(s) in 0.31s
Original:          3.02 MiB
Stripping Unused Data Segments...
    Size:          1.27 MiB (57.9% smaller)
Execute a binaryen optimization pass on your WASM....
    Size:          1.13 MiB (11.5% smaller)

Final Size: 1.13 MiB (62.8% smaller)
Installing canisters...
Installing code for canister internet_identity, with canister ID rdmx6-jaaaa-aaaaa-aaadq-cai
Error: The replica returned an HTTP Error: Http Error: status 413 Payload Too Large, content type "", content: Request 0xd765228fa7a682b37d54af9f59e86f1b050a70701d769cf659b686c80ea49041 is too large. Message byte size 2112149 is larger than the max allowed 2097152.

I found that because the wasm file internet-identity/internet_identity.wasm is too large.

➜  nft-wallet git:(master) ✗ ll -k internet-identity                                                           (0s)[22-06-11 9:34:33]
total 2068
-rw-r--r--  1 gaomingjun  staff     2993  6 10 11:36 internet_identity.did
-rwxr-xr-x  1 gaomingjun  staff  2111723  6 11 09:14 internet_identity.wasm

use version

dfx 0.10.0
rust 1.58.1

wisarmy avatar Jun 11 '22 01:06 wisarmy

@frederikrothenberger is this expected?

@wisarmy A workaround here is to set the subnet type in dfx.json to system by adding the following:

"defaults": {
    "replica": {
      "subnet_type": "system"
    }
  }

domwoe avatar Jun 14 '22 06:06 domwoe

@domwoe: No, this is not expected. Also, this example does not use our recommended dev setup using Internet Identity (documented here: https://github.com/dfinity/internet-identity/tree/main/demos/using-dev-build). The newer dev builds of II are smaller and will not encouter this issue.

The example should be updated to use the recommended dev setup.

frederikrothenberger avatar Jun 14 '22 07:06 frederikrothenberger