Field reference failure on HTTP output plugin (message option) [SOLVED]

Hello,
I am failing to send events to an HTTP endpoint using field reference on the "message" setting. If I use the same configuration to send a hardcoded base64 encoded string (and not reference to a field), everything works OK. Here is my configuration:

filter {
ruby {
code => "require 'base64'; event['message_b64enc'] = Base64.encode64(event['message'])"
}
}

output {
http {
http_method => "post"
url => "https://msg.argo.grnet.gr/v1/projects/GRNET-NOC/topics/LOGSTASHNOC:publish?key=XXXXXXXXXX"
format => "message"
content_type => "application/json"
message => "{ "messages": [ { "attributes": {}, "data": "%{[message_b64enc]}" } ] }"
}
}

On logstash I get:
{:timestamp=>"2016-11-02T16:06:19.227000+0200", :message=>"[HTTP Output Failure] Encountered non-200 HTTP code 200", :response_code=>400, :url=>"https://msg.argo.grnet.gr/v1/projects/GRNET-NOC/topics/LOGSTASHNOC:publish?key=XXXXXXXXXXXXXXXXXXX

and on my endpoint:
ERROR#011400#011Invalid Message Arguments

It seems that I am missing something but not sure what. Any help would be appreciated.

Kindly,
Kostis

the normal Base64.encode64 adds a \n at the end of the string. can you try with Base64.strict_encode64(event['message']) instead?

@jsvd thanks mate, that was the problem