Unable to talk to my app through HTTP using curl

Hi there, I am trying to run my app in http mode using curl command however it has failed to connect and am unsure why. I have done everything correctly so far within the nix-shell environment.

[nix-shell:~]$ curl -X POST -H “Content-Type: application/json” -d ‘{“id”: “0”, “jsonrpc”: “2.0”, “method”: “call”, “params”: {“instance_id”: “test-instance”, “zome”: “hello”, “function”: “hello_holo”, “args”: {} }}’ http://127.0.0.1:8888

curl: (7) Failed to connect to 127.0.0.1 port 8888: Connection refused

Thank you for your help in advance!

Also when packaging my cc_tuts lib.rs file after replacing and editing it, it comes up with
error[E0463] : can’t find crate for std

Thanks :grinning:

Hello @akikoogawa7! Been seeing your name on Twitter; thanks for spreading the Holochain love on social media :purple_heart:

Questions:

  • Are you running it via holochain and a conductor config file, or via hc run?
  • If via holochain, could we see your conductor config file?

Thanks!

Thank you! It’s a pleasure to be part of the community and it’s so wonderful to see it grow with people who really resonate with the vision.
I am new to Rust and programming in general. I do intuitively understand it and am usually a quick learner, so apologies if my mistakes seem very silly.

Is this the file you are looking for?

conductor-config.toml
bridges = []
persistence_dir = ‘’
ui_bundles = []
ui_interfaces = []

[[agents]]
id = ‘hc-run-agent’
keystore_file = ‘testAgent’
name = ‘testAgent’
public_address = ‘HcScjN8wBwrn3tuyg89aab3a69xsIgdzmX5P9537BqQZ5A7TEZu7qCY4Xzzjhma’
test_agent = true

[[dnas]]
file = ‘/Users/akikoogawa/Desktop/holochain/core_concepts/cc_tuts/dist/cc_tuts.dna.json’
hash = ‘Qma4cdyixechUrcq1r7S7tKFrcYiy3hdoTBF7tzrAfQoiQ’
id = ‘hc-run-dna’

[[instances]]
agent = ‘hc-run-agent’
dna = ‘hc-run-dna’
id = ‘test-instance’

[instances.storage]
type = ‘memory’

[[interfaces]]
admin = true
id = ‘websocket-interface’

[[interfaces.instances]]
id = ‘test-instance’

[interfaces.driver]
port = 8888
type = ‘http’

[logger]
state_dump = true
type = ‘debug’

[logger.rules]
rules = []

[passphrase_service]
type = ‘cmd’

[signals]
consistency = false
trace = false

config.nix

{
name = “conductor”;

sha256 = {
linux = “0kdxg4qgbz0k3sdpjf4bb9c0nvg8ry5jffrvl8kvlnq6saxlzmw0”;
darwin = “1w4gzbspxs79xp54zfg23wc5dvjnwrz9iqsnpmdk0hbizpzj7pmi”;
};

binary = “holochain”;

deps = [];
}

Thank you very much for your help. :blush:

yup, that first file is the one; thanks. I don’t see anything weird here… @thedavidmeister @maackle @lucksus I don’t know who holds coherence on RPC interface setup, but do you see anything amiss here? Looks like just a plain conductor config from running hc run -i http -p 8888. For brevity, here’s the relevant section (all IDs referenced definitely exist in the rest of the config):

[[interfaces]]
admin = true
id = ‘websocket-interface’

[[interfaces.instances]]
id = ‘test-instance’

[interfaces.driver]
port = 8888
type = ‘http’

By the way:

I admire your courage, taking Rust on as one of your first languages. At the same time, I feel like it’s probably easier for a newcomer than for someone with a few languages under their belt — there are a lot of weird things that break expectations if you’re used to, say, JavaScript or C#.

1 Like

Hi @akikoogawa7!
That conductor config looks sane. Are you actually running it like this?

holochain -c <path to that file>

Or are you using

hc run

?

Either try running the holochain executable pointed to the config file, or if you want to run straight from your DNA source directory, do:

hc run --interface http --port 8888
1 Like

@akikoogawa7, additionally I would also try simply using localhost or 0.0.0.0 as your address in the curl command rather than 127.0.0.1, just to be sure.