I created a nodejs http server app to download a remote image, it functions fine as a standalone node js app, but the download file corrupts when using nodejs aws-lambda.
I have tried going into the aws gateway api settings and setitng the binary content type to allow all */*
request.get('https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png', {encoding:'binary'},function(error, response){ callback(null, { "statusCode" : 200, "headers": { 'Content-Type': 'application/octet-stream', 'Cache-Control': 'no-cache', 'Content-Disposition': 'attachment; filename="google.png"', 'Accept': 'application/octet-stream' }, "body" : response.body}); }); this code shows what is inside my lambda function. it seems that the received file has some sort of utf or encoding which corrupts it.
Question:
Has anyone experienced the same issue or can provide guidance on what could be causing the corrupt file?