Skip to content
CCPEDIAby Unity Nodes
App Development

TypeError: damlTypes.assembleTemplate is not a function

4 posts300 views4 likesLast activity Jul 2022

  1. rikotacardsOP

    Bit stuck here, anyone have an idea on how to resolve this?

    Context:
    This is running locally, I build dar files, run codegen, cd ui, npm start, and I see this in the browser.

    Issue occurs when:
    This is after using SDK 2.3.1
    SDK 2.3.2 also creates this.

    SDK 2.2.0 was still working fine, error only occurs after using the recently released SDK.

    This app is extended from create-daml-app. In previous versions of the create-daml-app,
    in daml.yaml, we DO NOT have the below

    codegen:
      js:
        output-directory: ui/daml.js
        npm-scope: daml.js
    

    However, I just created a new app using create-daml-app, and I can see in the daml.yaml

    sdk-version: 2.3.2
    name: create-daml-ap-p
    version: 0.1.0
    source: daml
    dependencies:
    - daml-prim
    - daml-stdlib
    - daml-script
    start-navigator: false
    codegen:
      js:
        output-directory: ui/daml.js
        npm-scope: daml.js
    # Remove this line when running against a ledger without user management.
    init-script: Setup:setup
    
    

    Would that be the issue?

    My current project, the daml directories are separate, there are deps to other daml projects. So for example,

    /main
       /Account
          /daml
          daml.yaml
    

    and the daml.yaml file looks like

    sdk-version: 2.3.2
    name: Account
    source: daml
    version: 0.0.1
    dependencies:
      - daml-prim
      - daml-stdlib
      - daml-script
      - ../Asset/asset.dar
      - ../User/user.dar
    
    sandbox-options:
      - --wall-clock-time
    

    Do I need to specify a codgen output dir now? (haven’t tried it yet btw) Seeking pointers in case anyone knows off the top of their head.

    Update,
    I don’t think I need to have the output destination in the daml.yaml, as I have a codegen.sh file
    daml codegen js main/Asset/asset.dar main/User/user.dar main/Account/account.dar -o ui/daml.js
    that specifies where.

  2. rikotacards 2

    My package.json deps were

      "@daml/ledger": "2.2.0",
        "@daml/react": "2.2.0",
        "@daml/types": "2.2.0",
    

    … might be the issue. Let me update that and see.

    Updated to

        "@daml/ledger": "2.3.2",
        "@daml/react": "2.3.2",
        "@daml/types": "2.3.2",
    

    Errors are gone again.

  3. Ben_M 1

    Self asked & answered, well done :+1:t2: