Ic-repl: Is there a way to connect to custom ic url?

The mainnet ic url from ic-repl is https://ic0.app. However, I wish to connect to my own ic url which probably runs at http://localhost:8000 and has a definited API address /api/v2/status. How can I achieve this? Should I run with dfinity/ic code in localhost port 8000?

Error trace:

Ping http://localhost:8000/...
Canister REPL
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: An error happened during communication with the replica: error sending request for url (http://localhost:8000/api/v2/status): error trying to connect: tcp connect error: Connection refused (os error 61)', src/helper.rs:94:40
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Based on the error message, you didn’t actually start a local replica. Did you run dfx start?

Is there a way to run the source of dfx (probably a rust program) that may exist in the ic repo?

Unlike https://ic0.app, starting a replica at local does not guarantee the path (/api/v2/status) was exists.

The error message now is 404:

ic-repl -r local
Ping http://localhost:8000/...
Canister REPL
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: The replica returned an HTTP Error: Http Error: status 404 Not Found, content type "text/plain; charset=UTF-8", content: ', src/helper.rs:94:40
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It should work with dfx 0.7.0. The default url is http://localhost:8000. You can also specify the a replica url via ic-repl -r http://localhost:8001

Thanks. Upgrading to v0.7.0 solved my problem.

The dfx source code lives in a separate repository that isn’t open sourced yet, but will be eventually.

1 Like