# Fetch Candid remotely

**URL:** <https://forum.dfinity.org/t/fetch-candid-remotely/27475>\
**Category:** Developers\
**Created:** [February 10, 2024, 4:45am UTC](https://forum.dfinity.org/t/fetch-candid-remotely/27475 "2024-02-10T04:45:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lastmjs](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/lastmjs/32/3406_2.png) [@lastmjs](https://forum.dfinity.org/u/lastmjs)\
**Post date:** [February 10, 2024, 4:45am UTC](https://forum.dfinity.org/t/fetch-candid-remotely/27475/1 "2024-02-10T04:45:38Z")

</div>

I would like to do fetch just the Candid for my canister remotely, while building everything else locally. Is this possible? I would like a dfx.json file that looks like this:

```json
{
    "canisters": {
        "backend": {
            "type": "custom",
            "main": "src/backend/index.ts",
            "candid": "https://raw.githubusercontent.com/demergent-labs/azle/main/server.did",
            "build": "npx azle backend",
            "wasm": ".azle/backend/backend.wasm",
            "gzip": true,
            "assets": [["src/frontend/dist", "dist"]],
            "build_assets": "npm run build"
        }
    }
}

```

But unfortunately I get this error:

```auto
Error: ENOENT: no such file or directory, open 'https://raw.githubusercontent.com/demergent-labs/azle/main/server.did'
    at Object.openSync (node:fs:603:3)
    at writeFileSync (node:fs:2324:35)
    at /home/lastmjs/development/azle/src/compiler/index.ts:315:26
    at time (/home/lastmjs/development/azle/src/compiler/utils/time.ts:10:26)
    at azle (/home/lastmjs/development/azle/src/compiler/index.ts:110:15)
    at Object.<anonymous> (/home/lastmjs/development/azle/src/compiler/index.ts:32:1)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module.m._compile (/home/lastmjs/development/azle/node_modules/ts-node/src/index.ts:1365:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Object.require.extensions.<computed> [as .ts] (/home/lastmjs/development/azle/node_modules/ts-node/src/index.ts:1368:12) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: 'https://raw.githubusercontent.com/demergent-labs/azle/main/server.did'
}

```

---

<div class="post-metadata">

**Author:** ![chenyan](https://avatars.discourse-cdn.com/v4/letter/c/35a633/32.png) [@chenyan](https://forum.dfinity.org/u/chenyan)\
**Post date:** [February 10, 2024, 4:52am UTC](https://forum.dfinity.org/t/fetch-candid-remotely/27475/2 "2024-02-10T04:52:08Z")

</div>

Not from dfx, but your build script can fetch it?

---

<div class="post-metadata">

**Author:** ![lastmjs](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/lastmjs/32/3406_2.png) [@lastmjs](https://forum.dfinity.org/u/lastmjs)\
**Post date:** [February 10, 2024, 2:34pm UTC](https://forum.dfinity.org/t/fetch-candid-remotely/27475/3 "2024-02-10T14:34:56Z")

</div>

I don’t think this will work using the candid property in dfx, because dfx will try to find it and end in an error. I would have to create a custom property.

The remote canister feature allows something like this, that’s why I was hoping it might just work. Can we not allow URLs like this to work for Wasm and Candid even if the entire canister isn’t remote?

---

<div class="post-metadata">

**Author:** ![chenyan](https://avatars.discourse-cdn.com/v4/letter/c/35a633/32.png) [@chenyan](https://forum.dfinity.org/u/chenyan)\
**Post date:** [February 10, 2024, 8:22pm UTC](https://forum.dfinity.org/t/fetch-candid-remotely/27475/4 "2024-02-10T20:22:06Z")

</div>

I mean the build script can fetch did file and the `candid` field will point to a local fetched file.

It feels a bit strange that a local project depends on an interface that is not local. How do we expect to update the interface, or what if the remote file is changed without developer noticing?

---

<div class="post-metadata">

**Author:** ![lastmjs](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/lastmjs/32/3406_2.png) [@lastmjs](https://forum.dfinity.org/u/lastmjs)\
**Post date:** [February 10, 2024, 9:11pm UTC](https://forum.dfinity.org/t/fetch-candid-remotely/27475/5 "2024-02-10T21:11:37Z")

</div>

Similar problems with a fully remote canister aren’t they?

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [February 12, 2024, 12:34pm UTC](https://forum.dfinity.org/t/fetch-candid-remotely/27475/6 "2024-02-12T12:34:42Z")

</div>

For custom canister types this is supported already (implemented in [this PR](https://github.com/dfinity/sdk/pull/2576)). I can do the following just fine:

```bash
dfx new --type rust hello
cd hello

```

replace dfx.json with

```json
{
  "canisters": {
    "hello_backend": {
      "candid": "https://raw.githubusercontent.com/demergent-labs/azle/main/server.did",
      "type": "custom",
      "build": [
        "cargo b -p hello_backend --target wasm32-unknown-unknown"
      ],
      "wasm": "target/wasm32-unknown-unknown/debug/hello_backend.wasm"
    }
  },
  "output_env_file": ".env",
  "version": 1
}

```

and then

```bash
dfx deploy

```

---

<div class="post-metadata">

**Author:** ![lastmjs](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/lastmjs/32/3406_2.png) [@lastmjs](https://forum.dfinity.org/u/lastmjs)\
**Post date:** [February 12, 2024, 1:30pm UTC](https://forum.dfinity.org/t/fetch-candid-remotely/27475/7 "2024-02-12T13:30:42Z")

</div>

So foolish of me, I didn’t even look into the stack trace to realize it was Azle’s retrieval of the Candid that was failing and not dfx’s.

Thanks!
