Error when deploying 1.75Gb canister

Hello to everyone from Cosmicrafts team!

We need some help as we tried to upload a newer version of the game to a canister we have to test and that on a local machine is running just fine.

The first steps to deploy ran as usual, the create and build commands finished without any problems.
On the third step, the install command, the motoko canister installed without a problem too, but the assets canister got an error while installing:

Uploading assets to asset canister…
Starting batch.
Staging contents of new and changed assets:
/9d301e84f84fd8f1a792cfadce7841f6.png 1/1 (80341 bytes)
/index2222.html 1/1 (934 bytes)
/index2222.html (gzip) 1/1 (453 bytes)
/f8557c9b3b087741952d39d9b00ed750.png 1/1 (1320 bytes)
/412ebab6a2086f93f355f7315c17f239.png 1/1 (610 bytes)
/sample-asset.txt 1/1 (24 bytes)
/Build/CosmicBuild.json 1/1 (568 bytes)
/Build/CosmicBuild.framework.js 1/1 (346201 bytes)
/Build/CosmicBuild.framework.js (gzip) 1/1 (74562 bytes)
/Build/CosmicBuild.data.unityweb 1/43 (1900000 bytes)
/Build/CosmicBuild.data.unityweb 2/43 (1900000 bytes)
.
.
.
/Build/CosmicBuild.data 8/31 (1900000 bytes)
/Build/CosmicBuild.data 9/31 (1900000 bytes)
/Build/CosmicBuild.data 10/31 (1900000 bytes)
/Build/CosmicBuild.data 11/31 (1900000 bytes)
An error happened during communication with the replica: error sending request for url (https://ic0.app/api/v2/canister/qkrei-niaaa-aaaaj-qagta-cai/read_state): http2 error: protocol error: not a result of an error

After the failure I tried to install the assets canister again, in case something went wrong with my internet, but the result was the same, the install broke on another point but it didn’t finish again.

I restarted my modem and router in case I was having some connectivity issues and tried again, but with the same result.

After that I tried starting the dfx as --emulator, which made it way slower and didn’t fix the problem.

Then I tried again with the normal dfx start and --clean to reset everything and the same result came up and with the downside that I already had consumed all my cycles on that canister, without getting even one successful deploy.

I added 2T more cycles and resumed my testing. I tried upgrading from dfx 0.8.1 to 0.8.3 and it didn’t work.

So finally I thought it was an error with the canister itself, so I used the dfx canister stop and dfx canister delete to start over from scratch and it gave even more trouble.
Now I use the canister create and it says it was already created, then the build and everything looks fine and finishes, but the install says:

[email protected]:~/Documents/dev/cosmicrafts$ dfx canister --network=ic --no-wallet create --all
Creating canister “cosmicrafts”…
“cosmicrafts” canister was already created on network “ic” and has canister id: “onhpa-giaaa-aaaak-qaafa-cai”
Creating canister “cosmicrafts_assets”…
“cosmicrafts_assets” canister was already created on network “ic” and has canister id: “qkrei-niaaa-aaaaj-qagta-cai”
[email protected]:~/Documents/dev/cosmicrafts$ dfx build --network=ic
Building canisters…
Building frontend…
[email protected]:~/Documents/dev/cosmicrafts$ dfx canister --no-wallet --network=ic install cosmicrafts_assets --mode=reinstall
Reinstalling code for canister cosmicrafts_assets, with canister_id qkrei-niaaa-aaaaj-qagta-cai
The replica returned an HTTP Error: Http Error: status 404 Not Found, content type “”, content: Requested canister does not exist

After this new error, I created a new canister for the assets with 2T cycles, tried again to deploy them and the same result keeps coming:

Installing code for canister cosmicrafts_assets, with canister_id b7g3n-niaaa-aaaaj-aadlq-cai
Uploading assets to asset canister…
Starting batch.
Staging contents of new and changed assets:
/9d301e84f84fd8f1a792cfadce7841f6.png 1/1 (80341 bytes)

/Build/CosmicBuild.data 17/31 (1900000 bytes)
/Build/CosmicBuild.data 18/31 (1900000 bytes)
/Build/CosmicBuild.data 19/31 (1900000 bytes)
An error happened during communication with the replica: error sending request for url (https://ic0.app/api/v2/canister/b7g3n-niaaa-aaaaj-aadlq-cai/read_state): http2 error: protocol error: not a result of an error

If you guys might have any idea of what could it be

4 Likes

You might try setting a memory allocation for the asset canister. This would look something like this in dfx.json:

{
    "canisters": {
        "cosmiccrafts_assets": {
            "type": "assets",
             ... other values
            "initialization_values": {
                "memory_allocation": "8GB"
            }
        }
    }
}
3 Likes

I had the same error, splitting up the files into multiple deploys helped me solve it.

Worked like charm Eric, thanks so much for your help!

If you don’t set a memory_allocation, my understanding is that the canister’s memory growth will be “best-effort”. What does that mean?

I thought that meant there was essentially no memory limit (outside of the subnet’s total capacity) and was therefore the most flexible option for memory-hungry canisters.

1 Like

i had the same understanding, this does not hold anymore?