Skip to content

Post-build step for asset canister fails because directory is considered to be outside the workspace root #2199

@paulyoung

Description

@paulyoung

My dfx.json looks like this:

{
  "version": 1,
  "dfx": "0.9.2",
  "canisters": {
    "myproject": {
      "type": "custom",
      "build": "nix build",
      "candid": "backend/src/myproject/src/myproject.did",
      "wasm": "result/target/wasm32-unknown-unknown/release/myproject.wasm"
    },
    "myproject_assets": {
      "type": "assets",
      "dependencies": [
        "myproject"
      ],
      "frontend": {
        "entrypoint": "result/dist/index.html"
      },
      "source": [
        "result/dist/"
      ]
    }
  },
  "networks": {
    "local": {
      "bind": "127.0.0.1:8000",
      "type": "ephemeral"
    }
  }
}

There's apparently some issue with using "result/dist/" as the source directory because when I run dfx deploy myproject_assets I see Error: The post-build step failed for canister 'ryjl3-tyaaa-aaaaa-aaaba-cai' with an embedded error: Directory at '/Users/py/projects/paulyoung/myproject/main/result/dist/' is outside the workspace root.

I suspect this is because result is actually a symlink to /nix/store/<hash>-myproject. I'm working around this for now but it might be nice if people could opt out of this check.

Also, is there a way to specify a build command for asset canisters? The above relies on the dependency of myproject to put the assets in the right place. It would help with my workaround if I could decouple the two.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions