diff --git a/synapse/federation/persistence.py b/synapse/federation/persistence.py
index 865766eb2c664a2f33512183f376960e927b0ca4..1a7cc02f92f9b3350085be0c911c9c1c54ef5003 100644
--- a/synapse/federation/persistence.py
+++ b/synapse/federation/persistence.py
@@ -99,5 +99,5 @@ class TransactionActions(object):
             transaction.transaction_id,
             transaction.destination,
             response_code,
-            encode_canonical_json(response_dict)
+            response_dict,
         )
diff --git a/synapse/storage/transactions.py b/synapse/storage/transactions.py
index b5b21a9b137bae843c69c54c11b108158ca45c97..624da4a9dc26675cd7f9e59303b1619979a6526d 100644
--- a/synapse/storage/transactions.py
+++ b/synapse/storage/transactions.py
@@ -162,7 +162,8 @@ class TransactionStore(SQLBaseStore):
         return self.runInteraction(
             "delivered_txn",
             self._delivered_txn,
-            transaction_id, destination, code, response_dict
+            transaction_id, destination, code,
+            buffer(encode_canonical_json(response_dict)),
         )
 
     def _delivered_txn(self, txn, transaction_id, destination,