From eb13166fb5fdd3c313d1f77b194177bb90748301 Mon Sep 17 00:00:00 2001 From: Nadav Har'El Date: Sun, 5 May 2019 20:16:13 +0300 Subject: [PATCH] alternator: change empty return of PutItem Without any arguments, PutItem should return no data at all. But somehow, for reasons I don't understand, the boto3 driver gets confused from an empty JSON thinking it isn't JSON at all. If we return a structure with an empty "attributes" fields, boto3 is happy. Signed-off-by: Nadav Har'El --- alternator/executor.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alternator/executor.cc b/alternator/executor.cc index f15f160840..dc726680a1 100644 --- a/alternator/executor.cc +++ b/alternator/executor.cc @@ -297,7 +297,10 @@ future executor::put_item(sstring content) { elogger.warn("Applying mutation {}", m); return _proxy.mutate(std::vector{std::move(m)}, db::consistency_level::QUORUM, db::no_timeout, tracing::trace_state_ptr()).then([] () { - return make_ready_future("{}"); + // The Boto3 gets confused if we return just an empty structure {}, + // thinking it isn't JSON at all. I don't know why, but putting an + // empty Attributes field in the result solves the problem. + return make_ready_future("{ \"Attributes\": {} }"); }); }