Javascript Files Appear to be Base64 Encoded

Hi All,

I’m new to serverless and was testing out lambda deployment of flask on python3. I started with this:

Which worked great. I then decided to try flask-restplus which loads in swagger, but all of the associated javascript files are being transmitted with base64 encoding. I’ve verified in the upload zip archive of the application that this isn’t the case and it must be something with how api gateway is handling js files? Images, html, css are all rending appropriately but after much digging I’m struggling to see what would be causing javascript files to be base64 encoded.

I’m effectively using this: serverless-flask/serverless.yml at master · alexdebrie/serverless-flask · GitHub

The only deviation I’ve tried without any apparent change is adding:
contentHandling: CONVERT_TO_TEXT
to the http event handler.

Any insight would be greatly appreciated!

So after some digging I found my issue was related to the serverless-wsgi module that I’m using with flask. It has a static list of mime types, where anything but these will become base64 encoded, and it seems that application/javascript isn’t one of them for some reason. I needed to add this type here:

not sure how I’m the first to run into this, but I submitted an issue.

1 Like