# Using contentHandling in serverless.yml

**URL:** <https://forum.serverless.com/t/using-contenthandling-in-serverless-yml/2047>\
**Category:** Serverless Framework\
**Created:** [June 12, 2017, 8:31am UTC](https://forum.serverless.com/t/using-contenthandling-in-serverless-yml/2047 "2017-06-12T08:31:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yamazaki](https://avatars.discourse-cdn.com/v4/letter/y/6de8d8/32.png) [@yamazaki](https://forum.serverless.com/u/yamazaki)\
**Post date:** [June 12, 2017, 8:31am UTC](https://forum.serverless.com/t/using-contenthandling-in-serverless-yml/2047/1 "2017-06-12T08:31:05Z")

</div>

I created a serverless project on AWS and I’m trying to convert the service into a project configured by serverless framework. I already appended http event in the events property of my serverless.yml and deployed it. The API was generated in API Gateway successfully, but when I tried to post a binary file via the api, I found that it was not encoded to BASE64 format. I exported the configuration files generated by serverless.yml and AWS console page and compared them. I found that `contentHandling: CONVERT_TO_TEXT` was missing in the file generated by serverless framework. I tried to add contentHandling below `events` but didn’t got any luck. Could somebody kindly tell me the solution to append contentHandling?

---

<div class="post-metadata">

**Author:** ![DavidWells](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/davidwells/32/201_2.png) [@DavidWells](https://forum.serverless.com/u/DavidWells)\
**Post date:** [June 13, 2017, 2:01am UTC](https://forum.serverless.com/t/using-contenthandling-in-serverless-yml/2047/2 "2017-06-13T02:01:32Z")

</div>

You might want to use this plugin: [https://github.com/maciejtreder/serverless-apigw-binary](https://github.com/maciejtreder/serverless-apigw-binary)

---

<div class="post-metadata">

**Author:** ![NaraGitHub](https://avatars.discourse-cdn.com/v4/letter/n/a5b964/32.png) [@NaraGitHub](https://forum.serverless.com/u/NaraGitHub)\
**Post date:** [June 16, 2017, 4:33pm UTC](https://forum.serverless.com/t/using-contenthandling-in-serverless-yml/2047/3 "2017-06-16T16:33:35Z")

</div>

Note: There are two almost named similar plug-in for Binary Support - Weird!!!

Read more in detail of AWS doc for better understanding  
[http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings.html](http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings.html)

Plug-ins  
[https://github.com/ryanmurakami/serverless-apigwy-binary](https://github.com/ryanmurakami/serverless-apigwy-binary)\>\>  
[https://github.com/maciejtreder/serverless-apigw-binary/blob/master/index.js](https://github.com/maciejtreder/serverless-apigw-binary/blob/master/index.js)\>\>

Both works on create Stack , but not on update Stack - getting this error

============================  
Serverless Error ---------------------------------------

```
 An error occurred while provisioning your stack: ApiGatewayDeployment1497629194364
 - The REST API doesn't contain any methods.

```

======================

---

<div class="post-metadata">

**Author:** ![maciejtreder](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/maciejtreder/32/738_2.png) [@maciejtreder](https://forum.serverless.com/u/maciejtreder)\
**Post date:** [June 19, 2017, 5:25pm UTC](https://forum.serverless.com/t/using-contenthandling-in-serverless-yml/2047/4 "2017-06-19T17:25:42Z")

</div>

Hello,

First of all, I am happy to see that plugin developed by me is mentioned here.

Second:

NaraGitHub, I am happy to inform you, that in the newest version, plugin is based on update action. After stack deployment it is using AWS sdk, to perform update on API gateway.

And no, this plugins are not same. The one developed by ryanmurakami is setting CONVERT\_TO\_BINARY on the resource. Plugin developed by me ([https://github.com/ryanmurakami/serverless-apigwy-binary](https://github.com/ryanmurakami/serverless-apigwy-binary)) is setting up general binary support (Binary Support section in API gateway settings).

You can check out the working demo here:  
[http://angular-universal-serverless.maciejtreder.com](http://angular-universal-serverless.maciejtreder.com)

> **[maciejtreder/ng-toolkit](https://github.com/maciejtreder/ng-toolkit)**
>
> :star: Angular tool-box! Start your PWA in two steps! Add Serverless support for existing projects and much more - maciejtreder/ng-toolkit

PS: Everyone! Feel free to give me a star on github, as a celebration of my first post on this forum! 🙂
