Serverless framework is corrupting PDF response

I have an existing Nodejs API which I am trying to port to serverless. I am currently testing it locally with the serverless-offline package. Everything seems to be working fine except my API route which returns a PDF file. As soon as I change to serverless, the PDF in the response is corrupted and unreadable. I have done some reading about the possibility that it is the API gateway which is attempting to convert to UTF-8 or something like that but have not found a solution. I have tried adding the wildcard binary types for the API gateway in the serverless.yml file but this did not help either. I tried asking for input on stackoverflow, but didn’t get any concrete solutions. I describe the problem in a bit more detail there, as well as provide my code. You can see that here.

Any ideas on what I can do to fix this? I really like the idea of the serverless framework but if I cannot get this working I’m not sure what I will do. I would appreciate any help I can get. Thanks!