Error when trying to make an inter canister call in a motoko project

I am trying to make inter canister calls to a deployed canister from my local canister as follows by interface:

public shared func getProducts() : async [ProductWithId] {

    let productsInterface = actor ("yg4ya-nyaaa-anaal-qb8eq-cai") : actor {
      getAllProducts : shared query () -> async [ProductWithId];
    };

    let products = await productsInterface.getAllProducts();

    Debug.print(debug_show(products));

    return products;
  };

I an getting this error:

Call was rejected:
Request ID: 2d550165d9436ed018c6f7cafc31c156baa9f583051085114972f50b08267116
Reject code: 4
Reject text: No route to canister yg4ya-nyaaa-anaal-qb8eq-cai

What am I missing?

Are you saying you’re trying to make a call to mainnet from local? That will not work. You have to have the same canister deployed locally, too

3 Likes

I deployed both of them, that workded, thanks