Sample for Binary Support using API Gateway REST API with Serverless Framework.
Python Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
Dockerfile
LICENSE
README.md
build_packages.sh
handler.py
requirements.txt
serverless.yml

README.md

serverless-framework-qrcode-service

Sample for Binary Support using API Gateway REST API with Serverless Framework.

Requirement

Usage

First, deploy.

$ bash ./build_packages.sh
$ sls deploy

$ aws apigateway update-rest-api \
--rest-api-id [API-ID] \
--patch-operations op=add,path=/binaryMediaTypes/image~1png

Click the check (Update) icon for the Lambda function.

check.png

Click the OK.

permit.png

Finally, deploy again.

$ sls deploy

request below.

$ curl -X GET -H "Accept: image/png" -H "Content-Type: image/png" "https://[API-ID].execute-api.ap-northeast-1.amazonaws.com/dev/qrcode?text=Kappa"

Image returned.

Reference

krisgholson/serverless-thumbnail: Recreate the thumbnail service described here .. https://aws.amazon.com/blogs/compute/binary-support-for-api-integrations-with-amazon-api-gateway/ .. using the serverless.com framework (and document some gotchas).