fluree / dataset-academic-credentials

Repository for code and artifacts for loading the Academic Credentials sample dataset into Fluree.
MIT License
2 stars 1 forks source link

Tutorial step to create the ledger fails #7

Closed maxweber closed 8 months ago

maxweber commented 8 months ago

Hi, I'm trying to follow the tutorial. Here are the steps I did:

git clone https://github.com/fluree/dataset-academic-credentials.git && cd ./dataset-academic-credentials

To start the Fluree server I run:

docker run -p 58090:8090 -v `pwd`/data:/opt/fluree-server/data fluree/server

In a second attempt, I also used docker pull fluree/server beforehand to ensure that I have the latest version. And I also did the same experiment by starting the Fluree server via https://github.com/fluree/server/blob/da13c507126b11ae3043a757f478777b7db929fe/dev/src/user.clj#L111

However, everytime I do the next step of the tutorial:

curl -H "Content-Type:application/json" --data "@resources/00_create_ledger.jsonld" localhost:58090/fluree/create

I receive the following error in the Fluree server log:

08:23:50.339 [qtp709276713-38] DEBUG fluree.server.components.http - Unwrapped credential with did: nil
08:23:50.340 [qtp709276713-38] DEBUG fluree.server.handlers.create - create body: {"@context" {"f" "https://ns.flur.ee/ledger#"}, "@graph" [{"message" "New ledger created"}], "f:ledger" "academic-credentials-dataset", "f:
defaultContext" {"f" "https://ns.flur.ee/ledger#", "vc" "https://w3.org/2018/credentials#", "rdf" "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "schema" "http://schema.org/", "id" "@id", "wiki" "https://www.wikidata.org/
wiki/", "clr" "https://purl.imsglobal.org/spec/vc/ob/vocab.html#", "acd" "https://academic-credential-dataset.net/ns/", "rdfs" "http://www.w3.org/2000/01/rdf-schema#", "type" "@type", "sh" "http://www.w3.org/ns/shacl#", "
skos" "http://www.w3.org/2008/05/skos#", "xsd" "http://www.w3.org/2001/XMLSchema#"}}
Exception in thread "async-dispatch-7" java.lang.NullPointerException: Cannot invoke "Object.toString()" because "s" is null
    at clojure.string$starts_with_QMARK_.invokeStatic(string.clj:365)
    at clojure.string$starts_with_QMARK_.invoke(string.clj:361)
    at fluree.db.json_ld.api$address_QMARK_.invokeStatic(api.cljc:104)
    at fluree.db.json_ld.api$address_QMARK_.invoke(api.cljc:100)
    at fluree.db.json_ld.api$exists_QMARK_$fn__61671$state_machine__14708__auto____61676$fn__61678.invoke(api.cljc:152)
    at fluree.db.json_ld.api$exists_QMARK_$fn__61671$state_machine__14708__auto____61676.invoke(api.cljc:151)
    at clojure.core.async.impl.ioc_macros$run_state_machine.invokeStatic(ioc_macros.clj:972)
    at clojure.core.async.impl.ioc_macros$run_state_machine.invoke(ioc_macros.clj:971)
    at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:976)
    at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:974)
    at fluree.db.json_ld.api$exists_QMARK_$fn__61671.invoke(api.cljc:151)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at clojure.core.async.impl.concurrent$counted_thread_factory$reify__9672$fn__9673.invoke(concurrent.clj:29)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.base/java.lang.Thread.run(Unknown Source)
08:23:50.513 [qtp709276713-38] DEBUG fluree.server.consensus.core - Consensus - queue new ledger: nil "f6bcb423ceef7b556c47ffb54e1b39c7e3a732eebeb4e39410ac784d44029805" {"@graph" [], "f:ledger" [{"@value" "academic-creden
tials-dataset"}], "f:defaultContext" [{}]}
08:23:50.526 [async-dispatch-9] DEBUG f.s.components.consensus-handler - New consensus event: :ledger-create {:txn {"@graph" [], "f:ledger" [{"@value" "academic-credentials-dataset"}], "f:defaultContext" [{}]}, :conn-type
 :file, :size 3, :tx-id "f6bcb423ceef7b556c47ffb54e1b39c7e3a732eebeb4e39410ac784d44029805", :ledger-id nil, :opts {:context {:type-key "@type", "f" {:id "https://ns.flur.ee/ledger#"}}}, :instant 1703665430513}
08:23:50.527 [async-dispatch-9] DEBUG f.s.consensus.handlers.create-ledger - "Queuing new ledger into state machine with params: {:txn {\"@graph\" [], \"f:ledger\" [{\"@value\" \"academic-credentials-dataset\"}], \"f:defa
ultContext\" [{}]}, :conn-type :file, :size 3, :tx-id \"f6bcb423ceef7b556c47ffb54e1b39c7e3a732eebeb4e39410ac784d44029805\", :ledger-id nil, :opts {:context {:type-key \"@type\", \"f\" {:id \"https://ns.flur.ee/ledger#\"}}
}, :instant 1703665430513}"
08:23:50.529 [clojure-agent-send-off-pool-0] DEBUG f.s.components.consensus-handler - Executing consensus processor fn: :ledger-create {:txn {"@graph" [], "f:ledger" [{"@value" "academic-credentials-dataset"}], "f:default
Context" [{}]}, :conn-type :file, :size 3, :tx-id "f6bcb423ceef7b556c47ffb54e1b39c7e3a732eebeb4e39410ac784d44029805", :ledger-id nil, :opts {:context {:type-key "@type", "f" {:id "https://ns.flur.ee/ledger#"}}}, :instant 
1703665430513}
Exception in thread "async-dispatch-3" 08:23:50.530 [clojure-agent-send-off-pool-0] DEBUG f.s.consensus.handlers.create-ledger - Ledger nil exists? nil
java.lang.NullPointerException: Cannot invoke "Object.toString()" because "s" is null
    at clojure.string$starts_with_QMARK_.invokeStatic(string.clj:365)
    at clojure.string$starts_with_QMARK_.invoke(string.clj:361)
    at fluree.db.json_ld.api$address_QMARK_.invokeStatic(api.cljc:104)
    at fluree.db.json_ld.api$address_QMARK_.invoke(api.cljc:100)
    at fluree.db.json_ld.api$exists_QMARK_$fn__61671$state_machine__14708__auto____61676$fn__61678.invoke(api.cljc:152)
    at fluree.db.json_ld.api$exists_QMARK_$fn__61671$state_machine__14708__auto____61676.invoke(api.cljc:151)
    at clojure.core.async.impl.ioc_macros$run_state_machine.invokeStatic(ioc_macros.clj:972)
    at clojure.core.async.impl.ioc_macros$run_state_machine.invoke(ioc_macros.clj:971)
    at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:976)
    at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:974)
    at fluree.db.json_ld.api$exists_QMARK_$fn__61671.invoke(api.cljc:151)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at clojure.core.async.impl.concurrent$counted_thread_factory$reify__9672$fn__9673.invoke(concurrent.clj:29)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.base/java.lang.Thread.run(Unknown Source)
08:23:50.531 [clojure-agent-send-off-pool-0] INFO  fluree.db.json-ld.api - Creating ledger nil
08:23:50.533 [async-dispatch-5] DEBUG fluree.db.conn.core - Registering ledger:  nil  not-cached?  true
08:23:50.541 [async-dispatch-5] ERROR fluree.db.json-ld.api - #error {
 :cause "Cannot invoke \"Object.toString()\" because \"s\" is null"
 :via
 [{:type java.lang.NullPointerException
   :message "Cannot invoke \"Object.toString()\" because \"s\" is null"
   :at [clojure.string$starts_with_QMARK_ invokeStatic "string.clj" 365]}]
 :trace
 [[clojure.string$starts_with_QMARK_ invokeStatic "string.clj" 365]
  [clojure.string$starts_with_QMARK_ invoke "string.clj" 361]
  [fluree.db.ledger.json_ld$normalize_alias invokeStatic "json_ld.cljc" 191]
  [fluree.db.ledger.json_ld$normalize_alias invoke "json_ld.cljc" 188]
  [fluree.db.ledger.json_ld$create_STAR_$fn__58308$state_machine__14708__auto____58315$fn__58318 invoke "json_ld.cljc" 239]
  [fluree.db.ledger.json_ld$create_STAR_$fn__58308$state_machine__14708__auto____58315 invoke "json_ld.cljc" 214]
  [clojure.core.async.impl.ioc_macros$run_state_machine invokeStatic "ioc_macros.clj" 972]
  [clojure.core.async.impl.ioc_macros$run_state_machine invoke "ioc_macros.clj" 971]
  [clojure.core.async.impl.ioc_macros$run_state_machine_wrapped invokeStatic "ioc_macros.clj" 976]
  [clojure.core.async.impl.ioc_macros$run_state_machine_wrapped invoke "ioc_macros.clj" 974]
  [fluree.db.ledger.json_ld$create_STAR_$fn__58308 invoke "json_ld.cljc" 214]
  [clojure.lang.AFn run "AFn.java" 22]
  [java.util.concurrent.ThreadPoolExecutor runWorker nil -1]
  [java.util.concurrent.ThreadPoolExecutor$Worker run nil -1]
  [clojure.core.async.impl.concurrent$counted_thread_factory$reify__9672$fn__9673 invoke "concurrent.clj" 29]
  [clojure.lang.AFn run "AFn.java" 22]
  [java.lang.Thread run nil -1]]}
08:23:50.542 [clojure-agent-send-off-pool-0] ERROR f.s.components.consensus-handler - "Unexpected error in processor function for event :ledger-create with message: Cannot invoke \"Object.toString()\" because \"s\" is nul
l"
java.lang.NullPointerException: Cannot invoke "Object.toString()" because "s" is null
    at clojure.string$starts_with_QMARK_.invokeStatic(string.clj:365)
    at clojure.string$starts_with_QMARK_.invoke(string.clj:361)
    at fluree.db.ledger.json_ld$normalize_alias.invokeStatic(json_ld.cljc:191)
    at fluree.db.ledger.json_ld$normalize_alias.invoke(json_ld.cljc:188)
    at fluree.db.ledger.json_ld$create_STAR_$fn__58308$state_machine__14708__auto____58315$fn__58318.invoke(json_ld.cljc:239)
    at fluree.db.ledger.json_ld$create_STAR_$fn__58308$state_machine__14708__auto____58315.invoke(json_ld.cljc:214)
    at clojure.core.async.impl.ioc_macros$run_state_machine.invokeStatic(ioc_macros.clj:972)
    at clojure.core.async.impl.ioc_macros$run_state_machine.invoke(ioc_macros.clj:971)
    at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:976)
    at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:974)
    at fluree.db.ledger.json_ld$create_STAR_$fn__58308.invoke(json_ld.cljc:214)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at clojure.core.async.impl.concurrent$counted_thread_factory$reify__9672$fn__9673.invoke(concurrent.clj:29)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.base/java.lang.Thread.run(Unknown Source)
maxweber commented 8 months ago

Initially, I tried to do the tutorial directly on the documentation page. But there I received the following error:

image

Here the full error response:

{
  "message": "Invalid query: {:context {\"acd\" \"https://academic-credential-dataset.net/ns/\", \"clr\" \"https://purl.imsglobal.org/spec/vc/ob/vocab.html#\", \"vc\" \"https://www.w3.org/2018/credentials/v1\"}, :select {\"?credentials\" [\"*\"]}, :where {\"@id\" \"?credentials\", \"@type\" \"acd:Credential\"}, :opts {:context-type :string, :issuer nil}} - where: invalid type",
  "data": {
    "Ra": null,
    "Ma": 2,
    "Ia": [
      {
        "hd": null,
        "name": "status",
        "qb": "status",
        "$c": -1997798413,
        "Ka": 2153775105,
        "Pa": 4096
      },
      400,
      {
        "hd": null,
        "name": "error",
        "qb": "error",
        "$c": -978969032,
        "Ka": 2153775105,
        "Pa": 4096
      },
      {
        "hd": "db",
        "name": "invalid-query",
        "qb": "db/invalid-query",
        "$c": -1009699917,
        "Ka": 2153775105,
        "Pa": 4096
      }
    ],
    "Qa": null,
    "Ka": 16647951,
    "Pa": 401412
  },
  "cause": null,
  "name": "Error",
  "stack": "Error: Invalid query: {:context {\"acd\" \"https://academic-credential-dataset.net/ns/\", \"clr\" \"https://purl.imsglobal.org/spec/vc/ob/vocab.html#\", \"vc\" \"https://www.w3.org/2018/credentials/v1\"}, :select {\"?credentials\" [\"*\"]}, :where {\"@id\" \"?credentials\", \"@type\" \"acd:Credential\"}, :opts {:context-type :string, :issuer nil}} - where: invalid type\n    at new Cu (https://next.developers.flur.ee/assets/js/8a8b8c32.bd045955.js:1:266362)\n    at WL.Fa (https://next.developers.flur.ee/assets/js/8a8b8c32.bd045955.js:1:1197047)\n    at WL.Da (https://next.developers.flur.ee/assets/js/8a8b8c32.bd045955.js:1:1197004)\n    at kT (https://next.developers.flur.ee/assets/js/8a8b8c32.bd045955.js:1:708239)\n    at t (https://next.developers.flur.ee/assets/js/8a8b8c32.bd045955.js:1:955480)\n    at Function.e [as Ea] (https://next.developers.flur.ee/assets/js/8a8b8c32.bd045955.js:1:958492)\n    at Jh (https://next.developers.flur.ee/assets/js/8a8b8c32.bd045955.js:1:287262)\n    at https://next.developers.flur.ee/assets/js/8a8b8c32.bd045955.js:1:287430\n    at https://next.developers.flur.ee/assets/js/8a8b8c32.bd045955.js:1:1359248\n    at Fh (https://next.developers.flur.ee/assets/js/8a8b8c32.bd045955.js:1:285736)"
}
Jackamus29 commented 8 months ago

Hi @maxweber - thanks for opening an issue for this. Looks like the syntax has not yet been updated for the latest release of Fluree v3. I'll get that updated now so this tutorial will work for you.

That said, there is a known issue with browser-based Fluree so the documentation page that may continue to be broken.

Jackamus29 commented 8 months ago

Hi again @maxweber - please pull the latest commit and try the walkthrough in the README again. Let me know how it goes!

maxweber commented 8 months ago

Hi @Jackamus29 awesome :partying_face: Now every step of the tutorial works :+1: Thanks a lot.