daml icon indicating copy to clipboard operation
daml copied to clipboard

Script against JSON API fails to allocate party.

Open bame-da opened this issue 2 years ago • 0 comments

Daml version 2.8.3. This script:

test_allocate = do
  allocateParty "p"
  return ()
daml script --dar .daml/dist/x-0.0.1.dar --ledger-host http://localhost --ledger-port 7575 --json-api --script-name Main:test_allocate --access-token-file token

Results in

Exception in thread "main" com.daml.lf.engine.script.Script$FailedCmd: Command allocateParty failed: Request to /v1/parties/allocate with Some({"displayName":"p","identifierHint":""}) failed with status 400 Bad Request: List(PartiesService.toLedgerApi "Daml-LF Party is empty")
Daml stacktrace:
allocateParty at b4051d4bf6bfcec224c60defdbc0aedb60d0e3a9877f8bcc4853f59096da00bc:Main:35
	at com.daml.lf.engine.script.v1.Runner.$anonfun$runWithClients$11(Runner.scala:147)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:475)
	at org.apache.pekko.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:73)
	at org.apache.pekko.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:110)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:94)
	at org.apache.pekko.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:110)
	at org.apache.pekko.dispatch.TaskInvocation.run(AbstractDispatcher.scala:59)
	at org.apache.pekko.dispatch.ForkJoinExecutorConfigurator$PekkoForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:57)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: com.daml.lf.engine.script.v1.ledgerinteraction.JsonLedgerClient$FailedJsonApiRequest: Request to /v1/parties/allocate with Some({"displayName":"p","identifierHint":""}) failed with status 400 Bad Request: List(PartiesService.toLedgerApi "Daml-LF Party is empty")
	at com.daml.lf.engine.script.v1.ledgerinteraction.JsonLedgerClient.$anonfun$requestSuccess$1(JsonLedgerClient.scala:152)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:470)
	... 12 more

The token used is

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwczovL2RhbWwuY29tL2xlZGdlci1hcGkiOnsibGVkZ2VySWQiOm51bGwsInBhcnRpY2lwYW50SWQiOiJzYW5kYm94IiwiYXBwbGljYXRpb25JZCI6bnVsbCwiYWRtaW4iOnRydWUsImFjdEFzIjpbInAiXSwicmVhZEFzIjpbXX19.kdyANYbBradsVVcw0ob5mNjQM8Bbt7LUJTNQ3BoZ3Ak

which decoded is

{
   "https://daml.com/ledger-api": {
     "ledgerId": null,
     "participantId": "sandbox",
     "applicationId": null,
     "admin": true,
     "actAs": ["p"],
     "readAs": []
   }
}

bame-da avatar Feb 28 '24 16:02 bame-da