Max
April 7, 2022, 4:34pm
1
"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
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?
Max
April 7, 2022, 6:27pm
2
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
Max
April 7, 2022, 8:28pm
4
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.
Max
April 7, 2022, 8:34pm
5
So I
deleted the UI asset from daml hub
Deleted the zip file, and the dar file from my project directory
Re-ran daml build -o wallet-refapp.dar
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)
Uploaded the dar, set up the trigger on the daml hub console
Re uploaded the UI assets, and I’m getting the same error.
Max
April 7, 2022, 8:43pm
6
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.