Skip to content
Discussions/App Development/Cannot Resolve Template IDForum ↗

Cannot Resolve Template ID

App Development7 posts488 views1 likesLast activity Apr 2022
MA
MaxOP
Apr 2022
"JsonError: Cannot resolve template ID, given: TemplateId(Some(202b55c41494f90da86e3ef1bea984cbff11e245a9bbda4bcf64c66b4a08bcfa),Account,AssetHoldingAccount)"

Seems to be the same issue here

This error arises when the DAR you ran daml codegen js against is not known to the JSON API which in turn gets the list of packages from the participant and refreshes it automatically. There are two common causes: The DAR did not get uploaded to the participant. Sounds like you checked that, so that shouldn’t be it. The generated JS code refers to an older version of a DAR. E.g., let’s say you build a DAR, run daml codegen js and then modify your Daml code and rebuild the DAR and upload that …

However, I only run into this when I build my DAR file WITH the Trigger.daml. FYI, I can successfully run the trigger locally.

So when trying to deploy the dar with the trigger on Daml hub, I do

daml build -o wallet-refapp.dar

Upload that from the web console,

Then I do

daml build
daml codegen js .daml/dist/wallet-refapp-0.1.0.dar -o ui/daml.js
(cd ui && npm install && npm run-script build && zip -r ../wallet-refapp-ui.zip build)

and upload the UI Asset to the web console.

When I refresh my app, I will see
Screenshot 2022-04-07 at 9.31.10 AM

Now when I go back to my branch without the trigger, and re-do all this (re-upload the dar, etc) the app works as intentioned

any ideas? Will having a trigger affect this?

MA
Max
Apr 2022

There seemed to be an bug with the trigger itself, below is the fixed version

  registeredTemplates = T.RegisteredTemplates [T.registeredTemplate @AssetHoldingAccountRequest, T.registeredTemplate @AssetHoldingAccount],

Previously I had

@Account.AssetHoldingAccountRequest

registeredTemplates = T.RegisteredTemplates [T.registeredTemplate @Account.AssetHoldingAccountRequest, T.registeredTemplate @Account.AssetHoldingAccount],

CO
cocreature
Apr 2022

Could you explain how fixing the trigger can fix the frontend? That seems completely unrelated to me.

What I suspect has happened is that you modified the trigger but did not rerun the codegen before. That creates a new dar with a new package id and to the ledger the templates in that DAR are completely different so your codegen was still referencing the old templates.

That’s why it’s usually better to put triggers in a separate DAR outside of your templates that depends on your main DAR so that you can change your trigger without changing the package id of your templates.

MA
Max
Apr 2022

yeah I’m running into the issue again. But this time I didn’t make any changes to the trigger.

I actually always rerun the codgen (at least I think I do) I’ve deleted the dar file and have re-done this a few times and I’m running into the issue.

Let me try to separate the trigger.

MA
Max
Apr 2022

So I

  1. deleted the UI asset from daml hub
  2. Deleted the zip file, and the dar file from my project directory
  3. Re-ran daml build -o wallet-refapp.dar
  4. did
daml build
daml codegen js .daml/dist/wallet-refapp-0.1.0.dar -o ui/daml.js
(cd ui && npm install && npm run-script build && zip -r ../wallet-refapp-ui.zip build)
  1. Uploaded the dar, set up the trigger on the daml hub console
  2. Re uploaded the UI assets, and I’m getting the same error.
MA
Max
Apr 2022

I do have a previously uploaded UI Asset that I’ve disabled in the daml console. If I enable THAT one, I don’t get the error.

So it seems like something is not linking up

CO
cocreature
Apr 2022

It looks like you are updating your trigger but not your actual template dar. That’s why you have two wallet-refapp.dar files with a different hash which will include different copies of the template.

← Back to Discussions