2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

AWS SAM CLI で mediaをPOST bodyに加えてPOSTできるようにする

Last updated at Posted at 2021-01-30

AWS SAM CLI で mediaをPOST bodyに加えてPOSTできるようにする

初めてPython3.8 Lambdaを利用した時の備忘録。
multipart-form-dataを利用してmedia(png, jpeg etc...)をPOSTした時に 502 BadGatewayが帰ってきたた

TLDR

template,yamlにBinaryMeidiaTypesを付け加えれば、multipart-form-dataで送信できる。

template.yaml
Globals:
  Function:
    Timeout: 3
  Api:
    BinaryMediaTypes: ["*~1*"]

BinaryMediaTypesについては、/を~1に変更する必要があります。

AWS::Serverless::Api Document

Sample repo

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?