DFX does not deploy backend canister

I am attempting to deploy the Rust program listed on the Adding and searching simple records page as a backend canister.

I currently have the following dfx.json:

{
  "canisters": {
    "app": {
      "backend": {
        "main": "backend/main.rs",
        "type": "rust"
      },
      "frontend": {
        "entrypoint": "src/index.tsx"
      },
      "source": ["build"],
      "type": "assets"
    }
  }
}

Within my backend folder, I have a cargo.toml and main.rs. The main.rs consists of the code listed in this page.

When I run dfx build and then dfx deploy, it currently only builds and deploys the frontend. What could I be doing wrong?

Replace the dfx.json with this one and rename your canister at your convenience

{
  "canisters": {
    "rust_profile_backend": {
      "candid": "src/rust_profile_backend/rust_profile_backend.did",
      "package": "rust_profile_backend",
      "type": "rust"
    },
    "rust_profile_frontend": {
      "dependencies": [
        "rust_profile_backend"
      ],
      "frontend": {
        "entrypoint": "src/rust_profile_frontend/src/index.html"
      },
      "source": [
        "src/rust_profile_frontend/assets",
        "dist/rust_profile_frontend/"
      ],
      "type": "assets"
    }
  },
  "defaults": {
    "build": {
      "args": "",
      "packtool": ""
    }
  },
  "output_env_file": ".env",
  "version": 1
}```
1 Like

This defines a single canister "app", within which you have "backend", which is ignored because the canister app is of type assets. Move backend up by one level and it should work

Thank you for the response! How did

Ah, it seems like I will need to generate a candid file in order for it to work. I’ll take a look!