The following is my daml & ui codebase.
daml.yaml
sdk-version: 1.13.1
name: tydei-dev-auth
source: ./
parties:
- Operator
- BioMed
- FirstHealth
version: 1.1.1
dependencies:
- daml-prim
- daml-stdlib
- daml-trigger
- daml-script
sandbox-options:
- –wall-clock-time
- –ledgerid=tydei-dev
init-script: Scripts.InitializeScript:initializeTest
package.json
“dependencies”: {
“@daml/hub-react”: “^0.3.0”,
“@daml/ledger”: “1.13.1”,
“@daml/react”: “1.13.1”,
“@daml/types”: “1.13.1”,
“@daml2js/tydei-dev-auth”: “file:…/daml2js/tydei-dev-auth-1.1.1”,
…
ui/file.js
import { Auth } from “@daml2js/tydei-dev-auth”;
const Relationship = Auth.Main.Relationship.Relationship;
I faced the error message while running ui
Download the React DevTools for a better development experience: https://fb.me/react-devtools
module.js:107 Uncaught TypeError: damlTypes.assembleTemplate is not a function
at ./node_modules/@daml2js/tydei-dev-chat/lib/Auth/Main/Relationship/module.js (module.js:107:1)
at webpack_require (bootstrap:785:1)
at fn (bootstrap:150:1)
Please help me to fix this error.
My first instinct would be to verify whether you have to re-run codegen after some change to your Daml model.
Furthermore, you are using version 1.13.1, which is extremely dated. I would recommend to evaluate moving on to a more recent version. The latest is 2.5.3 as of the time of writing.
I built some packages and codegen them.
build.sh
DAML_PROJECT=${root_dir}/daml/${daml_version}/develop/Util daml build
DAML_PROJECT=${root_dir}/daml/${daml_version}/develop/Auth daml build
daml codegen js -o ${root_dir}/daml2js ${root_dir}/daml/${daml_version}/develop/Util/.daml/dist/tydei-dev-util-${daml_version}.dar ${root_dir}/daml/${daml_version}/develop/Auth/.daml/dist/tydei-dev-auth-${daml_version}.dar
Is there any reason you can’t upgrade to at least 1.18.3? The transition to 2.0 can be a bit involved depending on the details of your setup, but going to the latest 1.x should be very easy.
In fact, it’s more difficult to upgrade version. To be honest, it worked yesterday. Today, I changed daml a little and installed ui, and got the above error.
Can you share the full code before/after, e.g. as a public project on GitHub? That would make helping you a lot easier.
I fixed after daml codegen agin. It’s amazing.
Thank you, @Gary_Verhaegen , @stefanobaghino-da
Thanks for letting us know. To clarify, note that every time you make a Daml code change you need to rewrite the codegen:
- at a very basic level, if you changed a data structure or the signature of a choice, that needs to be reflected in your code as well
- furthermore, the codegen also automatically generates package IDs for you to interact with your templates and choices – these package IDs are a hash of the compiler output and also changes across compiler versions, so even changes that only affect the body of a choice or simply upgrading the compiler version means you need to re-run the codegen before using it against the newer version of your model.
Finally I would like to suggest again to upgrade again at your earliest convenience, unless you want to throw away that code. Specifically referring to our open-source community offering, the 1.13.x release series is not going to receive further improvements or fixes. You can read more about our release life cycle in our docs as the page about Portability, Compatibility, and Support Durations — Daml SDK 2.5.3 documentation.