Error: Could not find a canister id to forward to

When trying to follow the beginning examples from this youtube video:

I got as far as this time stamp in the video, and everything went as expected. But then when trying to run the web page I get "no such file or directory.

Admins-MacBook-Pro:hello admin$ http://localhost:8000/?canisterId=ic:ryjl3-tyaaa-aaaaa-aaaba-cai

-bash: http://localhost:8000/?canisterId=ic:ryjl3-tyaaa-aaaaa-aaaba-cai: No such file or directory

I started chrome manually and put in my address but from the browser I get the error:

Could not find a canister id to forward to.

I tried to sub in each canister ID that was generated. It seems there is not a UI canister that does not appear the the video’s code, but I still get the same error:

Please help.
shakespeare1212
Family Game Night Forever

BTW: I just tried to invoke the greet function from the terminal and it works.

Admins-MacBook-Pro:hello admin$ sudo dfx canister call hello greet Jimbo

Password:

(“Hello, Jimbo!”)

Hey there, welcome!

If you’d like to “run” the webpage from a terminal I’d assume you need to run the browser first.

chromium https://google.com

As for your link, try deleting the characters “ic:”. My links look like this:

http://localhost:8000/?canisterId=ryjl3-tyaaa-aaaaa-aaaba-cai

Also, make sure the ID of the canister is correct by running

dfx canister id hello
1 Like

Hi,
In complement to the previous answer, I use the ./dfx/local/canister_ids.json file to know the IDs of my canisters.

3 Likes

@enzo After following your instruction every time I’m getting below the error.
open http://localhost:8080/?canisterId=rrkah-fqaaa-aaaaa-aaaaq-cai

Warning: unknown mime-type for "http://localhost:8080/?canisterId=rrkah-fqaaa-aaaaa-aaaaq-cai" -- using "application/octet-stream"
Error: no such file "http://localhost:8080/?canisterId=rrkah-fqaaa-aaaaa-aaaaq-cai"

But if I do the dfx start dfx deploy npm start not getting any error but browser asking me username and password. I tried ubuntu username password but it did not worked.

Please check stack over flow link for my detailed issue with screen shot : - Stack_Question
Please answer my question to get me started.
I also referred to given link :- from @kpeacock
Hello_World

my guess would be that you’re following an example that uses the old port for dfx, with a newer version that uses port 4943 by default.

You can fix this by changing the code, or by configuring your networks.json file to use port 8080.

{
  "local": {
    "bind": "127.0.0.1:8080",
    "type": "ephemeral",
    "replica": {
      "subnet_type": "application"
    }
  }
}

You can check the path for this file by running dfx info networks-json-path. You may need to create the file if it doesn’t already exist.

No Actually If I use the frontend url generated by dfx then no issue. I was using [Preformatted text](http://localhost:8080/) url which is not required.

Thanks anyways :slight_smile:

1 Like