Error while trying "Hello Holo tutorial"!

@f13end @ahmetKM thank you for flagging. Yes, there seems to be a pattern with you all reporting the issue. :writing_hand::hammer_and_wrench:

My Cargo.toml file looks exactly the same!

hdk-proc-macros = “=0.0.34-alpha1”

My Cargo-toml file looks quite different:

hdk-proc-macros = “=0.0.34-alpha1”

I’m trying to reproduce this now with the same versions.
Those Cargo.toml files look wrong to me. It should be a git. “=0.0.34-alpha1” doesn’t make any sense.
@thedavidmeister Is this a weird vagrant / windows thing or is something broken?

Yep I’m also getting this. There’s a bug in hc generate that isn’t creating the Cargo.toml correctly.
I’ll report back when this is fixed.

Ok looks like
This:

hdk-proc-macros = "=0.0.34-alpha1"

Should be this:

hdk_proc_macros = "=0.0.34-alpha1"

Will update the generator but if you change this manually it should work :slight_smile:

1 Like

Yes to get it to compile I had to correct the following section of “./cc_tuts/zomes/hello/code/Cargo.toml” to be:

[dependencies]
serde = "=1.0.89"
serde_json = { version = "=1.0.39", features = ["preserve_order"] }
serde_derive = "=1.0.89"
hdk = { git = "https://github.com/holochain/holochain-rust", tag = "v0.0.34-alpha1" }
hdk-proc-macros = { git = "https://github.com/holochain/holochain-rust", tag = "v0.0.34-alpha1" }
holochain_wasm_utils = { git = "https://github.com/holochain/holochain-rust", tag = "v0.0.34-alpha1" }
holochain_json_derive = { version = "0.0.17" }

You might need to update the version tags of “v0.0.34-alpha1” with the current release.

1 Like

You can git rid of the git’s now that we are on crates.io.
You can copy this if you’d like:

[dependencies]
serde = "=1.0.89"
serde_json = { version = "=1.0.39", features = ["preserve_order"] }
serde_derive = "=1.0.89"
hdk = "=0.0.34-alpha1"
hdk_proc_macros = "=0.0.34-alpha1"
holochain_wasm_utils = "=0.0.34-alpha1"
holochain_json_derive = "=0.0.17"

[lib]
path = "src/lib.rs"
crate-type = ["cdylib"]
1 Like

Thank you very much @freesig! It worked!!!
I opened the Cargo.toml file in the editor with vim Cargo.toml. Than typed “i” for insert and changed the line “hdk-proc-macros=…” in “hdk_proc_macros=…” and typed “:wq!” to save it. After that I tried “hc package” again…

And than it worked properly! Thanks for your effort!
So I will move on to study the tutorials to learn more about Holochain.

1 Like

Sorry, now I´m running into the next problem. I could modify the lib.rs file and compiled it, so that I got the right result:
Created DNA package file at “/home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json”
DNA hash: QmXuPFimMCoYQrXqX9vr1vve8JtpQ7smfkw1LugqEhyWTr

But when I then run: “hc run -i http” I got the following error message:

[nix-shell:~/holochain/core_concepts/cc_tuts/zomes/hello/code/src]$ hc run -i http
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
conductor: boot_from_config
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
conductor: build_conductor_api instance_id=test-instance, config=Configuration { agents: [AgentConfiguration { id: “hc-run-agent”, name: “testAgent”, public_address: “HcScjN8wBwrn3tuyg89aab3a69xsIgdzmX5P9537BqQZ5A7TEZu7qCY4Xzzjhma”, keystore_file: “testAgent”, holo_remote_key: None, test_agent: Some(true) }], dnas: [DnaConfiguration { id: “hc-run-dna”, file: “/home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json”, hash: “QmXuPFimMCoYQrXqX9vr1vve8JtpQ7smfkw1LugqEhyWTr”, uuid: None }], instances: [InstanceConfiguration { id: “test-instance”, dna: “hc-run-dna”, agent: “hc-run-agent”, storage: Memory }], interfaces: [InterfaceConfiguration { id: “websocket-interface”, driver: Http { port: 8888 }, admin: true, instances: [InstanceReferenceConfiguration { id: “test-instance”, alias: None }] }], bridges: [], ui_bundles: [], ui_interfaces: [], logger: LoggerConfiguration { logger_level: “debug”, rules: LogRules { rules: [] }, state_dump: true }, network: None, persistence_dir: “”, signing_service_uri: None, encryption_service_uri: None, decryption_service_uri: None, dpki: None, signals: SignalConfig { trace: false, consistency: false }, passphrase_service: Cmd }
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
Failed to load instance test-instance from storage: ErrorGeneric(“State could not be loaded due to NoneError”)
Initializing new chain…
Error: Error while trying to create instance “test-instance”: Holochain Instance Error: Attempting to initialize DNA with zero zomes!

What I did wrong???

Same error for me;

[nix-shell:~/holochain/core_concepts/cc_tuts/zomes/hello/code/src]$ hc package
Created DNA package file at "/home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json"
DNA hash: QmXuPFimMCoYQrXqX9vr1vve8JtpQ7smfkw1LugqEhyWTr

[nix-shell:~/holochain/core_concepts/cc_tuts/zomes/hello/code/src]$ hc run -i http
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
conductor: boot_from_config
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
conductor: build_conductor_api instance_id=test-instance, config=Configuration { agents: [AgentConfiguration { id: "hc-run-agent", name: "testAgent", public_address: "HcScjN8wBwrn3tuyg89aab3a69xsIgdzmX5P9537BqQZ5A7TEZu7qCY4Xzzjhma", keystore_file: "testAgent", holo_remote_key: None, test_agent: Some(true) }], dnas: [DnaConfiguration { id: "hc-run-dna", file: "/home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json", hash: "QmXuPFimMCoYQrXqX9vr1vve8JtpQ7smfkw1LugqEhyWTr", uuid: None }], instances: [InstanceConfiguration { id: "test-instance", dna: "hc-run-dna", agent: "hc-run-agent", storage: Memory }], interfaces: [InterfaceConfiguration { id: "websocket-interface", driver: Http { port: 8888 }, admin: true, instances: [InstanceReferenceConfiguration { id: "test-instance", alias: None }] }], bridges: [], ui_bundles: [], ui_interfaces: [], logger: LoggerConfiguration { logger_level: "debug", rules: LogRules { rules: [] }, state_dump: true }, network: None, persistence_dir: "", signing_service_uri: None, encryption_service_uri: None, decryption_service_uri: None, dpki: None, signals: SignalConfig { trace: false, consistency: false }, passphrase_service: Cmd }
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
Failed to load instance test-instance from storage: ErrorGeneric("State could not be loaded due to NoneError")
Initializing new chain...
Error: Error while trying to create instance "test-instance": Holochain Instance Error: Attempting to initialize DNA with zero zomes!

oh you want to always run the hc or holochain commands from the root of the project.
So the cc_tuts folder.
I should make this more clear.

1 Like

Thanks for solution but i’m running into new problem.

[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
{"jsonrpc":"2.0","error":{"code":-32602,"message":"Holochain Instance Error: Zome function 'hello_holo' not found in Zome 'hello'"},"id":"0"}

and my lib.rs file

#![feature(proc_macro_hygiene)]

extern crate hdk;
extern crate hdk_proc_macros;
extern crate serde;
extern crate serde_derive;
extern crate serde_json;
extern crate holochain_json_derive;

use hdk::{
   error::ZomeApiResult,
};


use hdk_proc_macros::zome;

#[zome]
mod hello_zome {

    #[init]
    fn init() {
        Ok(())
    }

    #[validate_agent]
    pub fn validate_agent(validation_data: EntryValidationData<AgentId>) {
        Ok(())
    }

    #[zome_fn("hc_public")]
    fn hello_holo() -> ZomeApiResult<String> {
       Ok("Hello Holo".into())
    }


}

What did i miss ?

Thanks for all advice btw…
Holo team is the best

1 Like

Hello @freesig,
well, not intentionally. I just followed the tutorial description. But of course I want to go the most reasonable way…
What would be the best method in your opinion?
Thank you very much for your support!

The only thing I can see that is different is there is a #[macro_use] missing above the serde_derive crate. Maybe try adding that in and see if it works?

#[macro_use]
extern crate serde_derive;

Hey @newprometheus I’m not sure I understand your question. Are you asking what is the best method to run the hc run -i http command?

All the hc run or holochain should be run from your project root. So in this case you don’t want to be in ~/holochain/core_concepts/cc_tuts/zomes/hello/code/src.
You want to be in cc_tuts.
So it would be:

[nix-shell: cd ~/holochain/core_concepts/cc_tuts
[nix-shell: hc package
[nix-shell: hc run -i http

Does that help?

Holy Moly it’s worked.

[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

{"jsonrpc":"2.0","result":"{\"Ok\":\"Hello Holo\"}","id":"0"}

Thanks for reply.

1 Like

Yes, that was my question! That helps, thank you @freesig!
Now, everything worked fine!

My first tutorial is finish! :slight_smile:

1 Like

@newprometheus @f13end It makes us super happy to see you both completing the tutorials and everything working for you.

@newprometheus any constructive feedback you can provide regarding this tutorial or about the Core Concepts?

Thank you very much for your help!
For me, it would be great, if the tutorials would include some videos or screen-recording while you enter the commands. Than we could better see/understand from where we have to enter the commands.
Best regards

2 Likes