Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/createUser error when running the script in CantonForum ↗

createUser error when running the script in Canton

App Development3 posts227 views2 likesLast activity May 2022
DO
Dorrit_DuOP
May 2022

Hi team,

I am using daml script to to create User base on party and the dar file deployed to Canton. However when trying to run the script on Canton, the script failed on createUser. Can you advise please?

Daml script

  createUserFromParty: Party -> Script ()
    createUserFromParty p = do
      -- add alias for mapping
      let hint = getPartyHint p
      submit p do createCmd Alias with currentParty = p; displayName = hint; ..
      userId <- validateUserId $ asciiToLower hint
      createUser (User userId $ Some p) $ (CanActAs p) :: [CanReadAs public]

Error when running the daml script

~/canton-enterprise-2.0.0$ daml script --dar da-marketplace-0.2.0.dar --script-name Tests.FundManagement.Distribution:preMarketUISetupTest --participant-config participant.json
Exception in thread "main" com.daml.lf.engine.script.ScriptF$FailedCmd: Command createUser failed: No default participant
Daml stacktrace:

thanks,
Dorrit

SO
soren
May 2022

Hi Dorrit,

How does your participant.json look like? You need to specify a default_participant in case you use daml script in a distributed topology, see Daml Script — Daml SDK 2.2.0 documentation.

DO
Dorrit_Du
May 2022
soren:

default_participant

thanks Soren. after adding default_participant and it works!

← Back to Discussions