title: (AWS Lambda) "errorMessage": "Unable to marshal response: Object of type HTTPResponse is not JSON serializable"
body: <p>So I have been testing my server API via POSTMAN and the result looks like this:
  <a href="https://i.stack.imgur.com/SdBua.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SdBua.png" alt="enter image description here" /></a></p>
  <p>My goal with the AWS Lambda is to show (in the log) whatever the json response you get from this API. My code in the lambda looks like this:</p>
  <pre><code>import json
  import urllib3
  
  
  def lambda_handler(event, context):
      http = urllib3.PoolManager()
  
      response = http.request('GET',
                          &quot;http://106.10.54.227:9062/api/v1/weather-api&quot;,
                          retries = False)
      
      return response
  </code></pre>
  <p>However when I test this lambda function, I get this error:</p>
  <pre><code>Response:
  {
    &quot;errorMessage&quot;: &quot;Unable to marshal response: Object of type HTTPResponse is not JSON serializable&quot;,
    &quot;errorType&quot;: &quot;Runtime.MarshalError&quot;
  }
  </code></pre>
  <p>What I do not understand is the fact that the response from the API is the JSON itself so I don't know why it complains it is not serializable.</p>
  <p>Is there any way to fix this issue? Thanks a lot!</p>