Regarding running two different backend canisters in local environment (reject code DestinationInvalid)

Hello,
This is an issue I’m currently facing and need help with in regards to running two different backends, launchpad and kong swap backends. This launchpad is a project of mine, which has a inter canister call to add_pool function of kong swap for autolisting.
In order to test it, I wanted to run them together in local environment.
and I’ve been facing issues to run both together probably because, in kong_backend canister:
Using project-specific network ‘local’ defined in /home//kong/dfx.json
It says the above, whenever I dfx start in that directory.
while, in launchpad, it does this:
Using the default configuration for the local shared network.

So, ever since, I’ve been doing dfx start in one directory, and deploying the project (let say, launchpad) in that directory, that works, but when I go to kongswap and just simply run their deploy script, it gives me these errors:
The replica returned a rejection error: reject code DestinationInvalid, reject message Canister cbefx-hqaaa-aaaar-qakrq-cai not found, error code Some(“IC0301”)

for every canister on kong.
But, it happens viceversa, when I dfx start in kong directory, that deployment works, but my launchpad gives trouble. So, got to know that, the local environments is the issue. Can anyone please help me with this?

These are the project repositories, any ideas on how to test, and to try will be much appreciated.
I’ve been stuck with this for a while, please help.

You need to ensure the launchpad and KongSwap use the same network configuration, otherwise they will not find each other. The KongSwap dfx.json specifies subnet type to be system.

  "networks": {
    "local": {
      "bind": "localhost:4943",
      "type": "ephemeral",
      "replica": {
        "subnet_type": "system"
      }
    },
1 Like

Thanks for the reply, I’ve added the same “networks” in launchpad dfx.json,
and I’ve started the dfx in my launchpad directory and my scripts works fine, and my canisters are deployed successfully, but on deploying the canisters in KongSwap, I get these errors for all the canisters:
Installing code for canister kong_data, with canister ID cbefx-hqaaa-aaaar-qakrq-cai
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to install all canisters.
Caused by: Failed to install wasm module to canister ‘kong_data’.
Caused by: Failed during wasm installation call
Caused by: The replica returned a rejection error: reject code DestinationInvalid, reject message Canister cbefx-hqaaa-aaaar-qakrq-cai not found, error code Some(“IC0301”)

Can you please help me with this?

Hey, back from the holidays. I would need to see your repository to give you a better answer.

Hello, thanks for your reply.
Upon removing the subnet type in their dfx.json, I was able to run both in local, thanks a lot.

1 Like

What this does is it defines a project-specific network. If you have one of those, dfx will generally not see canisters in other directories. If you remove the networks entry you will end up on the local shared network, which is what you want to do if you want to connect across different projects. You need to remove this entry in both/all projects

2 Likes

Sounds exactly like what I did, I didn’t explain it well above. But yeah thanks for clearing it out, severin :slight_smile:

2 Likes