D/with not working inside tx fn

It seems that using d/with inside of a deployed transaction function no longer works. Yesterday I re-deployed an app (after having taken it down a few months ago) which has a tx fn trident.datomic-cloud.txauth/authorize that looks like this:

(defn authorize
  [db authorizers uid tx]
  (let [{:keys [tx-data db-before db-after] :as result} (d/with db {:tx-data tx})]
  ...

But now the d/with call is throwing an exception. I have verified that tx contains valid transaction data. Here’s the relevant part of the stack trace:

        "Via": [
            {
                "Type": "clojure.lang.ArityException",
                "Message": "Wrong number of args (1) passed to: datomic.client.impl.local/wrap-tx-result",
                "At": [
                    "clojure.lang.AFn",
                    "throwArity",
                    "AFn.java",
                    429
                ]
            }
        ],
        "Trace": [
            [
                "clojure.lang.AFn",
                "throwArity",
                "AFn.java",
                429
            ],
            [
                "clojure.lang.AFn",
                "invoke",
                "AFn.java",
                32
            ],
            [
                "datomic.client.impl.local",
                "invokeStatic",
                "local.clj",
                325
            ],
            [
                "datomic.client.impl.local",
                "invoke",
                "local.clj",
                290
            ],
            [
                "datomic.client.api.protocols",
                "invoke",
                "protocols.clj",
                126
            ],
            [
                "datomic.client.api",
                "invokeStatic",
                "api.clj",
                304
            ],
            [
                "datomic.client.api",
                "invoke",
                "api.clj",
                294
            ],
            [
                "trident.datomic_cloud.txauth",
                "invokeStatic",
                "txauth.clj",
                86
            ],

I’m running version 8794 of datomic cloud.

Hi Jacob,

I have reproduced this and we are working on a fix for the next release. Thanks for the report!

Stu

1 Like

Today’s release of Datomic Cloud (Datomic Cloud 589-8846) includes a fix for this issue.

1 Like

While the above is fixed in Datomic Cloud, calling d/with in a transaction function when using dev-local file system storage will still throw. I’ve filed an ask.datomic request on the bug here: ClassCastException, d/with inside transact function - Datomic Knowledgebase.