Jeff Headley
Jeff Headley

Reputation: 1

AWS Lambda Serverless Framework Custom Fonts - Vuetify .woff .ttf files are not rendering

I've used the serverless framework to deploy my Vuetify build to an AWS lambda function / API gateway. Everything is rendering properly locally with npx serve -s dist However, when I use express to serve the application over lambda/api gateway, all the files are fetched properly through the network, but the vuetify icons are not rendered. I receive the errors:

OTS parsing error: Size of decompressed WOFF 2.0 is less than compressed size

Failed to decode downloaded font

These files are not corrupted, I can download them over the network, replace my local files, and everything works as expected. Also, I can host the application via S3 and the S3 server correctly renders the icons from the WOFF files with 'Content-Type': 'binary/octet-stream' I'd like to be able to host the application on an AWS lambda so I can include authorization / redirect logic, using S3 with a lambda authorizer is not a feasible option at this point.

Please advise on why the express implementation of my lambda function cannot render Vuetify icons via these 'materialdesignicons.woff' files

Upvotes: 0

Views: 136

Answers (1)

Artur Shellunts
Artur Shellunts

Reputation: 94

If you talk about serverless-http library, one can set binary media types explicitly. Here is how:

serverless(app, {
    binary: ['font/*']
});

It should fix the issue. More examples in the documentation.

Upvotes: 0

Related Questions