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.