Assistance Required: Backend-Frontend Connection Error - subnet_not_found

Alright, solved. So the issue subnet_not_found error was thrown because I was (unexpectedly) performing a call against mainnet while my identity was generated and meant for the local replica.

I am facing the same issue but even without my frontend canister still facing it when I try to open the CANDID UI I tried this Dfx WARN: You seem to be running an outdated version of dfx. But I have latest version installed 0.12.1 - #10 by Severin nothgin was working I also tried using node16
info

  • dfx 0.15.3
  • macos m1
  • node v20.10.0
  • cargo 1.77.0-nightly (84976cd69 2024-01-12)
  • rustup 1.26.0 (5af9b9484 2023-04-05)
    This is the version for the rustup toolchain manager, not the rustc compiler.
    The currently active rustc version is rustc 1.77.0-nightly (714b29a17 2024-01-15)

That sounds very weird… is it possible that your dfx.json pins an older dfx version? What is the output of dfx start --clean -vv?

1 Like

Hey David,

I’m running into the same issue (400 subnet_not_found) while using the approve method of the ledger-icrc library.

I feel like I could be doing the same mistake without knowing it. Here’s my code:

import { IcrcLedgerCanister } from "@dfinity/ledger-icrc";

...

export default function Profile() {
    const { actor } = useActor();

    ...

    const { approve } = IcrcLedgerCanister.create({
        actor,
        canisterId: process.env.CANISTER_ID_ICP_LEDGER,
    });

    let approveArgs = {
          spender: {
              owner : Principal.fromText(principal),
              subaccount: []
          },
          amount: 1000000000000,
          expected_allowance: 100000000,
          fee: 10000
      }

      const data = await approve(approveArgs);
      console.log("data");

(process.env.CANISTER_ID_ICP_LEDGER outputs bkyz2-fmaaa-aaaaa-qaaaq-cai, my local icp ledger canister)

Am I missing a something?

Cheers!

const { actor } = useActor();

    ...

    const { approve } = IcrcLedgerCanister.create({
        actor,
        canisterId: process.env.CANISTER_ID_ICP_LEDGER,
    });

Not sure what actor is, but that’s not a valid parameter here. On the contrary, you could pass an agent to create an IcrcLedgerCanister object. If you don’t, it falls back to an agent for mainnet. I am guessing that’s the reason why you get the error mentioned in this thread.

actor is basically my canister (I’m using ic-use-actor library).

Using an agent like so…

const agent = await createAgent({
    identity,
    //host: HOST,
});

const { approve } = IcrcLedgerCanister.create({
    agent,
    canisterId: process.env.CANISTER_ID_ICP_LEDGER,
});

let approveArgs = {
    spender: {
        owner : Principal.fromText(principal),
        subaccount: []
    },
    amount: 1000000000000,
    expected_allowance: 100000000,
    fee: 10000
}

const data = await approve(approveArgs);
console.log(data);

…I’m gettting a Invalid certificate: Signature verification failed error. Any idea how to solve this one? (I was getting this error a few days ago - see here - this is why I tried to get creative and tried using actor)

const agent = await createAgent({
    identity,
    //host: HOST,
});

If you want to develop locally, you should create an agent that fetches fetchRootKey. You might also need to adjust host even though I guess you are using dfx and also guessing that agent-js default value is tailored for it but, not sure. I always set the value locally.

1 Like