Daml contracts appearing in daml script test but not in the navigator

Hi everybody
I am creating an application that tracks inventory and can update and delete as needed for the fundementals certification.

Atm I have a working test scripts for the templates with choices and can see them working as intended in the setup script test in vs code. My problem comes when I run daml start and in the navigator I don’t see the active contracts I created in the test scripts.
I am able to log in as all the different parties but none of them are able to view or create contracts in the navigator. The daml.yaml is set to init-script: Setup:setup. When inspecting f12 I get a 404 error
Failed to load resource: the server responded with a status of 404 (Not Found) but no other errors anywhere else. Could I not be connecting to the ledger correctly?

Hi @gabmora,

It’s going to be very hard to help you without access to your code. Is there a chance you may provide a link to a publicly-visible location where the code resides, suh as a GitHub project? Or perhaps just share the daml.yaml and Setup function here? Triple-quotes would be helpful for the latter option.

Hi @Gary_Verhaegen yes here is the github link:

Hi @gabmora,

I’m a bit curious as to why you started a project two weeks ago using a snapshot version from March?

Regardless, the issue here seems to be that you’re using an old way to configure the Navigator, using the parties entry in daml.yaml. This should probably warn (cc @Remy @Bas_van_Gijzel), as it’s no longer useful.

The short version is, Navigator will work if you remove that entry and instead create users in your setup script:

diff --git a/daml.yaml b/daml.yaml
index a4c87c0..8d1556a 100644
--- a/daml.yaml
+++ b/daml.yaml
@@ -1,11 +1,6 @@
 sdk-version: 2.7.0-snapshot.20230331.11634.0.c20fc05d
 name: InventoryManagement
 source: daml
-parties:
-  - Manufacturer
-  - Customer
-  - Sephora
-  - Ulta
 version: 0.0.1
 dependencies:
   - daml-prim
diff --git a/daml/Setup.daml b/daml/Setup.daml
index 0667a4e..f36ff61 100644
--- a/daml/Setup.daml
+++ b/daml/Setup.daml
@@ -6,7 +6,9 @@ import Inventory
 setup : Script ()
 setup = script do
     -- Allocate parties
-    manufacturer <- allocateParty "Manufacturer"
+    manufacturer <- allocatePartyWithHint "Manufacturer" (PartyIdHint "Manufacturer")
+    manufacturerId <- validateUserId "manufacturer"
+    createUser (User manufacturerId (Some manufacturer)) [CanActAs manufacturer]
     customer <- allocateParty "Customer"

     -- Create some Product contracts

The longer version is that, since the introduction of Canton in 2.0.0, party IDs are no longer predictable and thus cannot be part of daml.yaml. Instead, Navigator now relies on automatically detecting users rather than having a predetermined list of parties. Users can be created from your setup code as shown in the diff above.

Note that you need to both create the users and remove the parties entry, as the parties entry seems to have priority. I’m not entirely sure whether that’s intended or a bug.

Hi @Gary_Verhaegen,

That solve the issue thank you! The daml.yaml file was structured like that because I was following an old template that was made before that canton update.

Thank you again that was very helpful.

If it’s a template we host, could you point me to it? We may be able to update it so other people don’t get the same confusing experience.