Jason
02/07/2022, 2:29 PMDerek Kershner
02/07/2022, 4:31 PMRoss Coundon
02/07/2022, 6:26 PMRoss Coundon
02/07/2022, 6:27 PMRoss Coundon
02/07/2022, 6:28 PMconst sharpLayer = new LayerVersion(this, 'SharpLayer', {
code: Code.fromAsset('layers/sharp'),
compatibleRuntimes: [Runtime.NODEJS_14_X],
});
In your function def:
layers: [sharpLayer]
Jason
02/07/2022, 7:12 PMJason
02/08/2022, 6:15 PMDerek Kershner
02/08/2022, 6:16 PMCan I ignore everything outside of this directory and really just set up the lambda that lives there at some api route in my stack?Yup.
Ross Coundon
02/08/2022, 6:16 PMJason
02/08/2022, 6:58 PMJason
02/09/2022, 2:09 PMRoss Coundon
02/09/2022, 2:51 PMDerek Kershner
02/09/2022, 3:24 PMRoss Coundon
02/09/2022, 3:49 PMJason
02/09/2022, 4:09 PM{
'content-type': 'image/png',
'content-length': '124928',
connection: 'close',
date: 'Wed, 09 Feb 2022 16:05:40 GMT',
'x-amzn-requestid': '6e4330d3-d77f-4f6a-8163-64e2e2c11ca0',
'last-modified': 'Mon, 03 Jan 2022 23:43:08 GMT',
'access-control-allow-headers': 'Content-Type, Authorization',
'x-amz-apigw-id': 'NSDs7G9coAMFyxA=',
'cache-control': 'max-age=31536000,public',
'access-control-allow-methods': 'GET',
'x-amzn-trace-id': 'Root=1-6203e652-1ef7542901330cb02a548d40',
'access-control-allow-credentials': 'true',
'x-cache': 'Miss from cloudfront',
via: '1.1 <http://c1efe604ffd79a90be8f4d5002f8e908.cloudfront.net|c1efe604ffd79a90be8f4d5002f8e908.cloudfront.net> (CloudFront)',
'x-amz-cf-pop': 'LHR3-C1',
'x-amz-cf-id': 'RusCp2o9xzpSz7MsTJFOatNuRXd2yaFgVTKk7lioDzZcrQuXdo2TnA=='
}
I think the image being returned is base64 encoded. Looks like some api gateway setup im missingJason
02/09/2022, 4:23 PMbinaryMediaTypes: ['*/*']
to the config in my stackJason
02/09/2022, 4:23 PMRoss Coundon
02/09/2022, 4:26 PMRoss Coundon
02/11/2022, 6:49 PMbinaryMediaTypes
so curious where in the stack you configured it @Jason?Ross Coundon
02/11/2022, 6:50 PMJason
02/11/2022, 8:05 PMrestApi: {
binaryMediaTypes: ['*/*'],
},
in the api v1 props. When I converted it to a http API earlier today I removed itJason
02/11/2022, 8:07 PMRoss Coundon
02/11/2022, 8:12 PMDerek Kershner
02/11/2022, 8:24 PMJason
02/11/2022, 8:52 PMpath
to rawPath
where it was needed and removed everything in the image-requests.ts
file unrelated to the DEFAULT
request type which meant I could remove a few of the functions and unnecessary calls to that decodeRequest
method. it should be stable enough, im hoping. next I need to get the unit tests running though which should give me more confidenceJason
02/11/2022, 8:53 PMDerek Kershner
02/11/2022, 9:06 PM