Cannot Resolve Template ID

"JsonError: Cannot resolve template ID, given: TemplateId(Some(202b55c41494f90da86e3ef1bea984cbff11e245a9bbda4bcf64c66b4a08bcfa),Account,AssetHoldingAccount)"

Seems to be the same issue here

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?

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],

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.

1 Like

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.

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.

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

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.