Ic-reactor read_state,preview:subnet_not_found

image


Can I turn off this read_state using ic-reactor? My canister can be used directly locally, but it will fail when read_state is used.

This read_state probably is firing when you are attempting to make a call to an update function in your backend canister from your client. Are you attempting to make a call to an update function?

I do not think that there is a way to remove this.

CC: @b3hr4d (for ic-reactor)

2 Likes

Hello, I am using Ic-reactor library to initialize canister, it will call read_state method and get error 403, what could be the cause of this problem? I was using Connect2ic/react which doesn’t seem to have a read_state step, but canister works fine.

Hey, Can you share the code? How did you initialize and calling function?

1 Like

The local agents are connected first
image
Then we create the Actor
image
Finally wrap my App with Provider
image
And now I have

bd3sg-teaaa-aaaaa-qaaba-cai Where does this canisterId come from :disappointed_relieved:

In the above error, I did not call the read state method actively.

Do not need to use createAgentManager and AgentProvider at the same time, just pass the arguments into the AgenProvider and it will take care of agent behind the scene.

This is DidJs canister that will exist on dfx that power candid-ui and we will use it to convert downloaded did file into execuytable javascript file

This proccess can be ignored if you pass idlFactory from your canister declarations!

image
I replaced this, and I went back to the 400 error

image

You might be missing something on the project setup, is this vite?
Take a look at the examples or this next-template or this vite-template
This error is no from @ic-reactor/react anymore, those are about how your project handle API calls.

Okay, I understand. Thank you for your reply~

Pass the idlFactory if possible, and use CandidAdapterProvider when you dont have access to the declarations files.

import { idlFactory, canisterId, vault_factory } from "../../declarations/vault_factory"
import { createActorContext } from "@ic-reactor/react"

export const {
  ActorProvider: VaultFactoryProvider,
  useActorState: useICPLedgerState,
  useMethod: useVaultFactoryMethod,
  useQueryCall: useICDVQueryCall,
  useUpdateCall: useICDVUpdateCall,
} = createActorContext<typeof vault_factory>({
  idlFactory,
  canisterId: canisterId || "aiqu4-ruaaa-aaaaa-qaqaa-cai",
  withDevtools: true,
})

And if you get stocked, share you repo and I will help you with the setup.

1 Like

Wow, great. I’m very happy to have your guidance. Would tomorrow be all right? I have some other things to adjust today. :blush:

No problem :slight_smile: Happy to help you getting started with ic-reactor library.

1 Like

The experience of using ic-reactor is very good, my mood has become more pleasant and everything feels more controllable. And thank you very much for helping me! :rose: :rose: :rose:

1 Like