AWS Lambda http request: Unable to stringify body as json: Converting circular structure to JSON
<p>I would like to return the result of an HTTP request in my AWS Lambda function:</p>

<pre><code>var http = require('http');

exports.someFunction = function(event, context) {
     var url = "http://router.project-osrm.org/trip?loc=47.95,12.95&amp;loc=47.94,12.94";
     http.get(url, function(res) {
            context.succeed(res);
          }).on('error', function(e) {
            context.fail("Got error: " + e.message);
          });
}
</code></pre>

<p>It should return exactly what I get when I open the url directly in my browser (try it to see the expected json).</p>

<p>AWS Lambda return the following error message when I call <code>context.succeed(res)</code>:</p>

<pre><code>{
  "errorMessage": "Unable to stringify body as json: Converting circular structure to JSON",
  "errorType": "TypeError"
}
</code></pre>

<p>I assume that I need to use some property of <code>res</code> instead of <code>res</code> itself, but I couldn't figure out which one contains the actual data I want.</p>