node.js - AWS API Gateway Gzipped JSON file -


i have got setup api endpoint responds catalogue file around 18mb json file*, exceeds api gateways limit of 6mb.

i can gzip compress file 256kb in api gateway cannot set content-encoding gzip.

last november started allowing binarymimetypes examples have seen require data base64 encoded (standard lambda example, serverless example). require client not handle gzip base64.

however (aws-serverless-express example) seems include app.use(compression(()) makes me think possible send json response gzipped.

i have tried use aws-serverless-express example when try npm run setup fails create/update cloud formation stack.

i have local working node/express endpoint working using following code

var express    = require('express');  var app        = express();        var compression = require('compression'); var jsonfile = require('jsonfile'); const cors = require('cors'); var router = express.router();   app.use('/api', router); app.use(compression()) app.use(cors())  var port = process.env.port || 8080;  router.get('/', function(req, res) {     var file = './data/catalogue.json'     jsonfile.readfile(file, function(err, obj) {         res.json(obj);        })   }); app.listen(port); 

i new lambda , api gateway apologies such novice question. can provide or advice on how use lambda/api gateway gzip json file.

that's not approach (even without 6mb limit).

remember in using aws lambda, billed per 100 milliseconds. if sending lot of users, , each of them take time download it, cost lot.

my suggestion store on s3 (which fast), send s3 link on client, , let client download s3.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -