Upload image to Lambda using gateway API -
i'm trying let user upload pictures lambda function processing; using gateway api interface.
i tried specify model post method, far keep getting error
invalid model specified: validation result: warnings : [], errors : [invalid model schema specified]
... not helpful.
i understand cannot directly send raw data lambda , must using kind of formatting in-between.
what understood make gateway interface base64 encode data me.
i tried using following model schema content type image/jpeg
{ "body" : $util.base64encode($input.body) }
how send image ?
there no native support in api gateway binary data have seen. working on don't have eta you. customers have had success base64 encoding data have in question, should in mapping template in integration request not method request.
if set content type image/jpeg, encoding apply when content-type header on incoming request image/jpeg, make sure set that.
you can reject incoming requests method don't send right content type setting 'request body passthrough' (passthroughbehavior in api) recommended value ("when there no templates defined" or 'when_no_templates' in api)
docs passthrough behavior -> https://docs.aws.amazon.com/apigateway/api-reference/resource/integration/#passthroughbehavior
Comments
Post a Comment