I’m getting the following error message after dfx deploy:
Deploying all canisters.
All canisters have already been created.
Building canisters...
Building frontend...
Installing canisters...
Installing code for canister hosting, with canister_id rwlgt-iiaaa-aaaaa-aaaaa-cai
The replica returned an HTTP Error: Http Error: status 413 Payload Too Large, content type "text/plain; charset=UTF-8", content: Request 0xaf1d8dadf3f3c3faf56469c81b8806c9acfe09b8f8e1b92c3854e6a86ad7729e is too large.
$ dfx deploy --network=ic
Deploying all canisters.
Creating canisters...
Creating canister "hosting"...
"hosting" canister created on network "ic" with canister id: "lfvrz-miaaa-aaaab-aaaoa-cai"
Building canisters...
Building frontend...
Installing canisters...
Installing code for canister hosting, with canister_id lfvrz-miaaa-aaaab-aaaoa-cai
The replica returned an HTTP Error: Http Error: status 413 Payload Too Large, content type "text/plain; charset=UTF-8", content: Request 0x8b9216723a32e064d70bbcd4df766c040fc3808a9454c1d2cae2c331964a5a2c is too large.
To improve security, performance, and flexibility, there’s a 2MB restriction of the size of update messages. In most cases, this restriction should not prevent you from building and deploying applications to run on the Internet Computer. However, if you find this limitation hinders your ability to design and deploy canisters, contact DFINITY support with details about your use case and for help resolving the issue.
Honestly, I think that 2MB is definitely too small even for a very simple frontend or preloaded storage, especially considering that canisters can maintain up to 4GB of memory pages.
The 2MB limit is for individual files, not the whole directory. You can upload around 2GB of data (not the full 4GB because of GC) to the asset canister, as long as each file is smaller than 2MB.
The current workaround is to implement chunking in the frontend code. But I agree this should be done somewhere at the platform level.
$ dfx start
$ dfx deploy
$ Deploying all canisters.
$ Creating canisters...
$ Creating canister "rust_hello"...
$ Creating the canister using the wallet canister...
$ Creating a wallet canister on the local network.
$ The wallet canister on the "local" network for user "default" is "rwlgt-iiaaa-aaaaa-aaaaa-cai"
$ "rust_hello" canister created with canister id: "rrkah-fqaaa-aaaaa-aaaaq-cai"
$ Building canisters...
$ //build omitted, is successful
$
No idea what could be causing the payload to be so large. Seeking a way to debug this, or some clarity. Am just trying to follow the Rust quick start in the developer docs for now.
I’m getting a 403 every time I try to edit my original post for some reason… here is the actual error moment after the successful cargo build:
$ Installing canisters...
$ Installing code for canister rust_hello, with canister_id rrkah-fqaaa-aaaaa-aaaaq-cai
$ The replica returned an HTTP Error: Http Error: status 413 Payload Too Large, content type "text/plain; charset=UTF-8", content: Request 0x3d1159dd50d80118aab5417b323b995a1d0bf6465d8b89a06f7c795a728ad66a is too large.
@shan Can you run the ic-cdk-optimizer to trim the file size of the rust canister? There are pointers on how to do that here. Will make a note to merge that PR so it’s reflected in the docs.
The latest beta releases of dfx support chunking of large assets and you can try this in 0.7.0-beta.2 We’ll be publishing documentation on this soon. cc @ericswanson did all the amazing work for supporting this feature!
Ah; might want to note in the documentation that you need to make sure the release folder is created first in the target build output before setting that as an output for tired people like me
also will we see a dfx version 1.0 at the genesis? or have you guys built a whole development kit as a canister sitting on the ic or something like that? i know it says that the dfx tool as of now should not be used for production services, im curious what tool will be good for production. is the ic frontend canister guaranteed to support flutter compiled code? should i start building in flutter or wait till genesis to see what is supported?
For anyone else encountering this issue when trying to deploy a wasm32-unknown-unknown target in Rust; I made a very simple build script using cargo-make plugin to both build & optimize the wasm output in one go, commented here.
Please pay attention to the circled part if you see it. Just follow the instruction and install ic-cdk-optimizer (and perhaps also put ~/.cargo/bin in your PATH), and then deploy again. It should be a success.