title: To see JPG file from API gateway and Lambda
body: <p>I created some code on lambda using node.</p>
  
  <pre><code>const fs= require('fs');
  const axios= require('axios');
  
  exports.handler= async (event, context, callback) =&gt; {
  
    const imageBase64= await axios.get(
      'https://upload.wikimedia.org/wikipedia/commons/8/84/Prunus_flower.jpg',
      {responseType: 'arraybuffer'}
      ).toString('base64');
  
    return {
      statusCode: 200,
      headers: { 'Content-Type': 'image/jpeg' },
      body: imageBase64,
      isBase64Encoded: true,
      }
  }
  </code></pre>
  
  <p>I also set up API gateway.</p>
  
  <p>Binary Media Types is
  <code>image/*</code></p>
  
  <p>Then, when I access API gateway.
  I encountered bellow error.</p>
  
  <p><img src="https://i.stack.imgur.com/X3HGh.png" alt="enter image description here"></p>
  
  <p><a href="https://p9knlxmx62.execute-api.ap-northeast-1.amazonaws.com/img/" rel="nofollow noreferrer">https://p9knlxmx62.execute-api.ap-northeast-1.amazonaws.com/img/</a></p>
  
  <p>I'm not sure how can I fix this.</p>