Deploy frontend failed

Failed to create project asset: Failed to create encoding: Failed to create chunk: Failed to create chunk: The replica returned an HTTP Error: Http Error: status 500 Internal Server Error, content type "text/plain; charset=utf-8", content: backend_timeout.

ELIFECYCLE  Command failed with exit code 255.

What can i do when happend this error

Simply retry. Ideally dfx would retry on its own and does for a while, but looks like we missed one possibility

2 Likes

I came across a similar error, retried many times, however still giving the same error

I used this command on the terminal:
sudo dfx deploy --network ic

This is the output
Deploying all canisters.

All canisters have already been created.

Building canistersā€¦

Building frontendā€¦

WARN: Building canisters before generate for Motoko

Generating type declarations for canister firstICPwebsite3_frontend:

/Users/thomastay/firstICPwebsite3/src/declarations/firstICPwebsite3_frontend/firstICPwebsite3_frontend.did.d.ts

/Users/thomastay/firstICPwebsite3/src/declarations/firstICPwebsite3_frontend/firstICPwebsite3_frontend.did.js

/Users/thomastay/firstICPwebsite3/src/declarations/firstICPwebsite3_frontend/firstICPwebsite3_frontend.did

Generating type declarations for canister firstICPwebsite3_backend:

/Users/thomastay/firstICPwebsite3/src/declarations/firstICPwebsite3_backend/firstICPwebsite3_backend.did.d.ts

/Users/thomastay/firstICPwebsite3/src/declarations/firstICPwebsite3_backend/firstICPwebsite3_backend.did.js

/Users/thomastay/firstICPwebsite3/src/declarations/firstICPwebsite3_backend/firstICPwebsite3_backend.did

DEPRECATION WARNING: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

More info: Sass: Breaking Change: Legacy JS API

DEPRECATION WARNING: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

More info: Sass: Breaking Change: Legacy JS API

Installing canistersā€¦

Upgrading code for canister firstICPwebsite3_backend, with canister ID abd6n-vqaaa-aaaaj-azt4a-cai

Module hash 30337d4a52126c535dcb91cd5aa81221682c9233ed2e6a741196196b5b47ee32 is already installed.

Installing code for canister firstICPwebsite3_frontend, with canister ID agcyz-yiaaa-aaaaj-azt4q-cai

Error: Failed while trying to deploy canisters.

Caused by: Failed while trying to install all canisters.

Caused by: Failed to install wasm module to canister ā€˜firstICPwebsite3_frontendā€™.

Caused by: Failed during wasm installation call

Caused by: The replica returned an HTTP Error: Http Error: status 500 Internal Server Error, content type ā€œtext/plain; charset=utf-8ā€, content: backend_timeout

1 Like

Iā€™m having the same issue, mentioned in another thread with a less appropriate title.

My (perhaps incorrect) impression is that this relates to the (mis)handling of compressed files, based on the introduction of support for brotli compression in 0.21.0 and a post I saw somewhere (but canā€™t find now) about the protocol getting caught in a loop while trying to validate a chunk.

The release notes for 0.21.0 suggest that there was some update to error handling, where ā€œURLs that contain invalid encodings now return 400 Bad Request instead of 500 Internal Server Errorā€, which I take as a clue.

This cropped up for me while I was updating the header encodings, so it led me to think it is related. My .ic-assets.json file is in another post but @Severin believes this is not related, as this is on the application level and the error suggests it has deeper roots.

I am open to suggestions as this is currently blocking development. What would be the steps for a rigourous cleaning of all cache, both locally and existing on the canister (frontend) that could rule out this being triggered by artefacts from previous builds? I have tried deleting dist and .dfx directories, but this again seems to be at the application level, so might be the wrong tack.

I still think itā€™s not related to anything like that. If you look at the message above yours you can see the timeout when installing the wasm. That is before any of the logic specific to an asset canister runs. The status codes and brotli validation are relevant when you request an asset from an asset canister. The asset canister does not do any chunk validation - it simply assumes that the client is working.

Deleting dist, .dfx, maybe even node_modules. And then dfx canister uninstall-code on your frontend canister to wipe all state that lives on-chain.

@rbirkner is there anything we can do beyond retrying? This is becoming a more and more common issue

Thanks for the clarification

It is hard to guess what is happening. None of the boundary metrics show anything suspicious. It would be great to setup a call (if you can reproduce it) and see what is going on.

This issue went away, without giving up any more information, but has returned now that I am deploying new changes. The system configuration and target canisters are the same. The only real differences are slightly larger files (the largest is 48.3 MB) and that the error appears more quickly than beforeā€¦

Today I have been receiving internal error of both the 500 and 503 variety when using dfx deploy frontend --ic:

Caused by: Failed to create chunk: Failed to create chunk: The replica returned an HTTP Error: Http Error: status 503 Service Unavailable, content type "text/plain; charset=utf-8", content: error: upstream_error
details: The HTTP gateway is temporarily unable to process the request. Please try again later.
Caused by: Failed to create chunk: Failed to create chunk: The replica returned an HTTP Error: Http Error: status 500 Internal Server Error, content type "text/plain; charset=utf-8", content: backend_timeout

To try to isolate the issue, I switched to building and then using dfx canister install frontend --ic --mode=reinstall and have just received the following response, in place of the 500/503 error, which I thought might be of interest:

thread 'tokio-runtime-worker' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/h2-0.4.4/src/proto/streams/flow_control.rs:181:13:
assertion failed: self.window_size.0 >= sz as i32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)

@Severin I would be happy to give you/another access to the repo, to try and replicate the error. I am using WSL and am seeing this behaviour on dfx 0.21.0 and 0.22.0.

Im currently facing this issue, is there any known fix for this?

This is the error i encounter. I have retried multiple time still same. ```Failed asset sync with canister cv4ma-4qaaa-aaaal-adntq-cai.
Failed to create project asset: Failed to create encoding: Failed to create chunk: Failed to create chunk: The replica returned an HTTP Error: Http Error: status 503 Service Unavailable, content type "text/plain; charset=utf-8", content: error: upstream_error details: The HTTP gateway is temporarily unable to process the request. Please try again later. Failed to create encoding: Failed to create chunk: Failed to create chunk: The replica returned an HTTP Error: Http Error: status 503 Service Unavailable, content type "text/plain; charset=utf-8", content: error: upstream_error details: The HTTP gateway is temporarily unable to process the request. Please try again later.