Closed bradleyjames closed 7 years ago
Tested using this ruby script:
require 'json'
test = {
foo: 'bar',
test: [1, 2, 3]
}
File.open(ENV['RUMBDA_RESULT_JSON_FILENAME'], 'w') do |f|
f.write(test.to_json)
end
def main
puts 'hello'
end
main
I think this is passive.
API Gateway expects JSON to be returned from a Lambda. This, no matter how hackish, accomplishes that. The nodejs side of things passes a key in the event object to tell the ruby side of things where to write its JSON. It's ugly but passive to the current way of doing things. Also puts still behaves as before on the ruby side which was important.
I also updated to using callback rather than context.done() which is deprecated in Lambda's node v4.3 and v6.10 APIs.