I have a serverless app which uploads files to s3 (via POST request) and serves them (via GET request)
In order to upload an image the POST endpoint takes a body like { "base64": "..." }. However with this configuration the entire body is coming through as a base64 encoded string. How can I prevent the request body with application/json being transformed?
See serverless.yml below:
service: image-service
custom:
envName: ${opt:stage, self:provider.stage}
domains:
prod: api.<mydomain>
dev: dev-api.<mydomain>
customDomain:
basePath: images
domainName: ${self:custom.domains.${self:custom.envName}}
certificateName: "*.<mydomain>"
apigwBinary:
types:
- '*/*'
provider:
name: aws
runtime: nodejs8.10
region: eu-west-1
memorySize: 1536
role: ImageRenderingRole
environment:
ENV_NAME: ${self:custom.envName}
APP_NAME: image-service
BUCKET: <mybucket>
plugins:
- serverless-offline
- serverless-domain-manager
- serverless-apigw-binary
- serverless-apigwy-binary
functions:
uploadImage:
handler: handler.uploadImage
events:
- http:
path: /
method: POST
getImage:
handler: handler.getImage
events:
- http:
path: 'images/{idAndFormat}'
method: get
contentHandling: CONVERT_TO_BINARY
parameters:
paths:
idAndFormat: true
This is a clone of (https://stackoverflow.com/questions/52479994/serverless-api-gateway-transforming-request-into-base64) but no response as of yet...
I have a serverless app which uploads files to s3 (via POST request) and serves them (via GET request)
In order to upload an image the POST endpoint takes a body like { "base64": "..." }. However with this configuration the entire body is coming through as a base64 encoded string. How can I prevent the request body with
application/jsonbeing transformed?See
serverless.ymlbelow:This is a clone of (https://stackoverflow.com/questions/52479994/serverless-api-gateway-transforming-request-into-base64) but no response as of yet...