Hello all, I use the svelte-motoko-starter projet.
After 2 days, it became a battle… and the more time I spend, the less I can give up. Now I’m one millimeter away from success
For the update method, without query, it seems to properly write data, but I got the error.
It seems possible to work but i don’t really like to have this in my terminal and I can’t know if it could make other errors later.
Don’t break your head too much for this, but in case you have a quick idea… I will be happy.
I don’t have the reference from the doc right here and did not search through the forum but basically, to give you a really short answer, query calls cannot modify the state of the canisters, only update calls can.
It has to do with security, persistance etc. worth having a deeper look but just wanted to give you a short feedback.
Thank you, yes, that’s why I mentionned the problem only occur with update methods…
It doesn’t explain why it works with localhost:5000 adress on in live on the mainet… … No problem, I’m finally going back to continue my project like this.
Oh my bad, I misunderstand your question and skipped the error message.
So if I get it right, it does not work because of the error printed above Fail to verify certificate.
I think this happens often locally when the fetchRootKey is not called for local development. Do you do so?
agent.fetchRootKey().catch(err => {
console.warn("Unable to fetch root key. Check to ensure that your local replica is running");
console.error(err);
});
I don’t use the fetchRootKey, I doesn’t really understand what is it and how to use.
I think I can work a little like this for now. If I spend another hour debugging, I’ll definitely give up everything. I’ll probably come back to this later and send you the project if needed. Thank you very much.
fechtRootKey is needed for local development. when you want to call your local replica - started with dfx start - agent js will need to validate the certificate which is initialized with fechtRootKey
long story short, to develop locally - and locally only - fechtRootKey needs to be called