Open bahulneel opened 1 year ago
I have a very simple namespace:
(ns ....db.core (:require [fluree.db.api :as fdb] [clojure.edn :as edn])) (def *config (atom nil)) (def *conn (atom nil)) (defn load-config ([] (load-config "./.config.edn")) ([file] (-> file slurp edn/read-string))) (defn ledger ([] (ledger @*config)) ([{:keys [:db/network :db/db]}] (println network db) (str network "/" db)) ) (defn connect ([] (connect @*config)) ([{:keys [:db/url :db/keypair]}] (let [conn (fdb/connect url {:private (:private keypair)})] conn))) (defn db [] (let [ledger (ledger)] (println ledger) (fdb/db @*conn ledger))) (defn init! [] (reset! *config (load-config)) (reset! *conn (connect))) (comment (init!) @(fdb/query (db) {:select ["*"] :from "_collection"}))
with the following config
#:db{:url "https://api.dev.flur.ee:443", :network "fluree", :db "387028092977578", :keypair {:private "***", :public "022111162e2e558783f5f5603a926dd478faf29a23338d73449d70001f869c9d97"}}
when I eval the code in the comment I get:
clj꞉....db.core꞉> {:id "521bc562-0de5-4697-af5f-112cb593de81", :servers ["https://api.dev.flur.ee:443"], :state #<Atom@3abe18ff: {:close? false, :health {}, :connected-to nil, :socket nil, :socket-id nil, :pending-req {}, :listeners {}}>, :req-chan #object[clojure.core.async.impl.channels.ManyToManyChannel 0x291f3c9 "clojure.core.async.impl.channels.ManyToManyChannel@291f3c9"], :sub-chan #object[clojure.core.async.impl.channels.ManyToManyChannel 0x221d794c "clojure.core.async.impl.channels.ManyToManyChannel@221d794c"], :pub-chan #object[clojure.core.async.impl.channels.ManyToManyChannel 0x591c0ae "clojure.core.async.impl.channels.ManyToManyChannel@591c0ae"], :group nil, :storage-read #function[fluree.db.connection/default-storage-read/fn--54657], :storage-list nil, :storage-write #function[fluree.db.connection/generate-connection/fn--54837], :storage-exists #function[fluree.db.connection/default-storage-read/fn--54657], :storage-rename nil, :storage-delete nil, :object-cache #function[fluree.db.connection/default-object-cache-fn/fn--54759], :async-cache #function[fluree.db.connection/default-async-cache-fn/fn--54763], :parallelism 4, :serializer {}, :default-network nil, :transactor? false, :publish nil, :transact-handler nil, :tx-private-key nil, :tx-key-id nil, :meta nil, :add-listener #function[clojure.core/partial/fn--5908], :remove-listener #function[clojure.core/partial/fn--5908], :close #function[fluree.db.connection/generate-connection/close--54839], :memory false, :keep-alive nil, :keep-alive-fn nil} clj꞉....db.core꞉> fluree 387028092977578 fluree/387028092977578 #error { :cause "xhttp error - https://api.dev.flur.ee:443/fdb/storage/fluree/387028092977578/root/000000000000001: 400 - error response" :data {:url "https://api.dev.flur.ee:443/fdb/storage/fluree/387028092977578/root/000000000000001", :error :xhttp/exception, :status 400} :via [{:type clojure.lang.ExceptionInfo :message "xhttp error - https://api.dev.flur.ee:443/fdb/storage/fluree/387028092977578/root/000000000000001: 400 - error response" :data {:url "https://api.dev.flur.ee:443/fdb/storage/fluree/387028092977578/root/000000000000001", :error :xhttp/exception, :status 400} :at [fluree.db.util.xhttp$format_error_response invokeStatic "xhttp.cljc" 73]}] :trace [[fluree.db.util.xhttp$format_error_response invokeStatic "xhttp.cljc" 73] [fluree.db.util.xhttp$format_error_response invoke "xhttp.cljc" 34] [fluree.db.util.xhttp$get$fn__30386 invoke "xhttp.cljc" 166] [org.httpkit.client$request$deliver_resp__29702$fn__29703 invoke "client.clj" 271] [org.httpkit.client$request$deliver_resp__29702 invoke "client.clj" 270] [org.httpkit.client$request$reify__29706 onSuccess "client.clj" 310] [org.httpkit.client.Handler run "RespListener.java" 42] [java.util.concurrent.Executors$RunnableAdapter call "Executors.java" 577] [java.util.concurrent.FutureTask run "FutureTask.java" 317] [java.util.concurrent.ThreadPoolExecutor runWorker "ThreadPoolExecutor.java" 1144] [java.util.concurrent.ThreadPoolExecutor$Worker run "ThreadPoolExecutor.java" 642] [java.lang.Thread run "Thread.java" 1589]]} clj꞉touchpoint.db.core꞉>
I followed the instructions here to create the key pair. and added the auth to the DB using the HTTP w/ API_KEY method.
Hi @bahulneel
What version of the fluree db library are you using to try and connect?
I was the latest at the time
I have a very simple namespace:
with the following config
when I eval the code in the comment I get:
I followed the instructions here to create the key pair. and added the auth to the DB using the HTTP w/ API_KEY method.