How to access the canister frontend?

i started everything from scratch, using dfx build --provider https://gw.dfinity.network now i get this error

An error occured:
AgentError(
    ReqwestError(
        reqwest::Error {
            kind: Request,
            url: "https://gw.dfinity.network/api/v1/submit",
            source: hyper::Error(
                Connect,
                Error {
                    code: -9806,
                    message: "connection closed via error",
                },
            ),
        },
    ),
)

after retrying, this comes back

An error occured:
AgentError(
    ServerError {
        status: 502,
        content_type: Some(
            "text/plain",
        ),
        content: "Error connecting to gateway:\n\nHttpExceptionRequest Request {\n  host                 = \"10.11.23.1\"\n  port                 = 8080\n  secure               = False\n  requestHeaders       = [(\"X-Real-IP\",\"10.11.10.193\"),(\"Host\",\"gw.dfinity.network\"),(\"X-Real-IP\",\"80.137.40.16\"),(\"X-Forwarded-For\",\"80.137.40.16\"),(\"X-Forwarded-Proto\",\"https\"),(\"content-type\",\"application/cbor\"),(\"Authorization\",\"<REDACTED>\"),(\"accept\",\"*/*\")]\n  path                 = \"/api/v1/read\"\n  queryString          = \"\"\n  method               = \"POST\"\n  proxy                = Nothing\n  rawBody              = False\n  redirectCount        = 0\n  responseTimeout      = ResponseTimeoutNone\n  requestVersion       = HTTP/1.1\n}\n (ConnectionFailure Network.Socket.connect: <socket: 6>: does not exist (Connection refused))",
    },
)

After a third attempt it worked, but after running dfx canister --provider https://gw.dfinity.network install --all, the output is only Installing code for canister game_of_life, with canister_id ic:100000000000000000000000000000000001A9 , seems like the frontend canister isn’t installed at all?
Looking at the canister_manifest leads to the same conclusion:

{
  "canisters": {
    "game_of_life": {
      "candid_path": "/Users/moritz/projects/dfinity/game_of_life/canisters/game_of_life/game_of_life.did",
      "canister_id": "ic:100000000000000000000000000000000001A9",
      "timestamp": "Tue, 14 Jul 2020 20:42:24 +0000",
      "wasm_path": "/Users/moritz/projects/dfinity/game_of_life/canisters/game_of_life/game_of_life.wasm"
    }
  }
}%

Running dfx canister id game_of_life_assets leads to this error:

An error occured:
ComputeNetworkNotFound(
    "local",
)
1 Like

I get the first error you posted very often. I get kicked out eventually and have to re-enter my credentials. Not too sure why that happens either.

1 Like

Ok seems like you completely have to recreate the project structures, i just now got this. You can’t just simply change the version in dfx.json and it works

1 Like

So, I created a new project but it seems like canister create is having issues. It either returns a ConnectionReset error, times out, or tries to prompt for credentials.

Also, dfx ping without an arg simply hangs :upside_down_face:

2 Likes

I also get the connection reset error when running the dfx canister install command. The only command that doesn’t do this for me is dfx build.

edit: I’m unable to run dfx canister install anymore. I get this:

Replica error (code 3): IC0301: Canister ic:0E0000000000000000000000000000000001AC not found.

I was just able to build! Here is what i did:

  1. create a dummy project with dfx version 0.5.10 with dfx new dummy_project
  2. safe a copy of the dfx.json & webpack.config.js from the project you want to upgrade to 0.5.10
  3. copy the dfx.json & webpack.config.js from dummy project into the project you want to upgrade
  4. make changes to dfx.json you just copied, so it fits the project structure (basically just change all occurences dummy_project to the name of the project you’re trying to upgrade, in my case game_of_life)
  5. if you are using a .jsx file for the frontend, make sure you change the file ending accordingly in your dfx.json
  6. create the folders src/<your_project_name>_assets/public and src/<your_project_name>_assets/assets inside your project folder
  7. move the content of src/<your_project_name>/public into src/<your_project_name>_assets/public
  8. open the webpack.config.js file and head down to line 52, uncomment this section
  9. after line 39 you can add this if you’re using a .jsx file or something
    (actually this isn’t mandatory, works without it too. i had it in my 0.5.7 version so im keeping it for nostalgy :D)
    Bildschirmfoto 2020-07-15 um 14.40.44
  10. remove the state with rm -rf .dfx/state
  11. run npm install inside your directory
  12. try dfx build

    yayy :partying_face:
  13. good luck!

if anything is unclear, just checkout my repo, i’ve commited everything!

3 Likes

after commiting and pushing everything, i deleted my local game_of_life project and pulled it again. after running npm install i was able to build and and install without errors :slight_smile:


i then just took the whole canister id that is displayed from the install command 03000000000000000100000000000000000111.
calling https://03000000000000000100000000000000000111.ic0.app/ finally worked for me!!! what a time to be alive :relaxed:

unfortunately my front end doesn’t seem to do anything :frowning: is there anything im missing @hansl @alexa.smith ?

1 Like

Thanks for the walkthrough @cryptoschindler. Are you able to create new canisters fine? I’ve tried deleting my canister and recreating to solve my error, but it now hangs.

1 Like

@cryptoschindler Please try again. I think there was a teardown of the network overnight and another one 30 minutes ago, and might have been what happened. The network has been resetted.

2 Likes

trying to visit the frontened now leads to this:

An error happened:
https://03000000000000000100000000000000000111.ic0.app/bootstrap.js:2:49301
[email protected][native code]
[native code]
[email protected][native code]
[email protected][native code]

trying to reinstall leads to this:

Installing code for canister game_of_life, with canister_id ic:0200000000000000010000000000000000013B
Replica error (code 5): IC0104: Only the controller of canister ic:0200000000000000010000000000000000013B can control it.
Expected controller: PrincipalId([5, 252, 190, 56, 109, 66, 207, 216, 93, 210, 104, 134, 50, 110, 48, 175, 31, 114, 68, 128, 251, 150, 254, 136, 218, 236, 225, 122, 115, 209, 163, 116, 2])
Actual controller: PrincipalId([150, 33, 83, 13, 223, 84, 20, 104, 44, 212, 55, 235, 200, 166, 93, 83, 254, 187, 191, 11, 213, 28, 249, 197, 66, 184, 67, 155, 188, 185, 77, 93, 2])

i assume i have to install fresh?

Yes, there was a reset this morning. I’ve also been told that we’re working on communicating when those resets happen (ideally never, but this morning apparently was a last minute call and unplanned).

Hmm, same error after building and installing.

Replica error (code 5): IC0104: Only the controller of canister ic:0200000000000000010000000000000000013B can control it.
Expected controller: PrincipalId([5, 252, 190, 56, 109, 66, 207, 216, 93, 210, 104, 134, 50, 110, 48, 175, 31, 114, 68, 128, 251, 150, 254, 136, 218, 236, 225, 122, 115, 209, 163, 116, 2])
Actual controller: PrincipalId([150, 33, 83, 13, 223, 84, 20, 104, 44, 212, 55, 235, 200, 166, 93, 83, 254, 187, 191, 11, 213, 28, 249, 197, 66, 184, 67, 155, 188, 185, 77, 93, 2])

and this one

An error occured:
AgentError(
    ReqwestError(
        reqwest::Error {
            kind: Request,
            url: "https://gw.dfinity.network/api/v1/submit",
            source: hyper::Error(
                Connect,
                Error {
                    code: -9806,
                    message: "connection closed via error",
                },
            ),
        },
    ),
)

deleting the canisters folder lets me install and gives me a new id and this time it works :smile:!
is there a way we can see the output that would be printed on the replica terminal?

As of 2 hours ago, the network should be healthy and stable, so you should be able to publish to Tungsten.

is there a way we can see the output that would be printed on the replica terminal?

Not yet.

2 Likes

I sometimes get tls handshake eof errors when submitting a message, along with frequent prompts for HTTP credentials (even though it’s saved already).

1 Like

Using the frontend or the command line? I think your browser might be aggressively deleting local storage or cookies for third party, which is what we use for our data and auth.

1 Like

This is with the CLI, I’m running calls in a loop:

while true; do dfx canister --provider https://gw.dfinity.network call timestamp set `date +%s`; done

It looks like now the TLS errors are gone, but I get frequent ConnectionReset errors instead, and it still prompts for credentials.

Also, should Candid UI be available? It’s returning could not find _/candid/index.html in your content namespace

Last thing - how can we manage both local and remote canisters? Manually updating canister_manifest.json doesn’t seem ideal

2 Likes

had to share this: i don’t know why but running this on mobile gives such a different sensation than just seeing it on your computer as this really isn’t connected to the machine it was built on. made such a big difference to me realizing this now really is just out there on the ic.

6 Likes