Error: The certificate contains a delegation that does not include the canister aaaaa-aa in the canister_ranges field

Thanks @marc0olo.

I was able to reproduce the issue by cloning the repo and running the script locally. After debugging, I managed to isolate the problem and find a solution.

The code fails when calling provisional_create_canister_with_cycles if no canister ID is provided. This happens because the canisterId parameter is mapped to the effectiveCanisterId through the specified_id and transform function I mentionned earlier. That’s why providing one works, and leaving it empty does not.

If I supply a canister ID (for example, the one I use by default in Juno’s Docker setup), the script runs successfully and the canister is created.

const result = await this.management.provisionalCreateCanisterWithCycles({
  amount: cyclesToUse,
  canisterId: Principal.fromText('jx5yt-yyaaa-aaaal-abzbq-cai') // <----- 👀
});

Canister created successfully with provisional function!
Canister ID: jx5yt-yyaaa-aaaal-abzbq-cai

:tada: SUCCESS! Canister created successfully!

@Huygon764 can you give this a try specifying a canister ID?

@mraszyk @ilbert given the above, should we go ahead and implement the fix you suggested today or other ideas?

2 Likes

An alternative would to be to default to the effective canister ID provided in PocketIC topology record. Actually maybe that’s better after all.

2 Likes

Do you mean in the ic-management JS library? Not against sure, what’s the default or how can it be retrieved?

I mean in pic-js when creating a canister.

2 Likes

Ah gotcha. @ilbert WDYT?

Though OP is not using pic-js I think, probably rather DFX/PocketIC directly.

Makes sense! I’ve opened an issue for this: Pass the canister id when calling `provisionalCreateCanisterWithCycles` · Issue #189 · dfinity/pic-js · GitHub.

1 Like