2

I have a Lambda, written in Java, from which I want to output binary data (namely Excel spreadsheets). I noticed that the data being returned by the Lambda is mutated by Api Gateway. To investigate the problem, I created a simple Lambda which outputs:

{
  "statusCode": 200,
  "headers": {},
  "body": "AOld",
  "isBase64Encoded": true
}

This corresponds to the three (hex) bytes:

00 E9 5D

I then set up an API in Api Gateway. The API consists of a simple method on the root resource, whose integration request is a Lambda Function, with proxy integration, pointing at the above Lambda. I am passing in Content-Type and Accept headers, and the content types being used are marked as Binary media types. When this passes through API Gateway, however, I get

00 EF BF BD 5D

Any idea why Api Gateway is mangling my binary output?

1
  • I've tried to replicated this, and I haven't been successful as of yet. Can you confirm that you have redepoyed your API after making changes to your api config? Commented Apr 9, 2017 at 18:41

1 Answer 1

1

The problem ended up being with Postman, which I was using to do my queries. When I did the queries via curl in the command line, the problem went away.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.