JSPM

  • Created
  • Published
  • Downloads 2871
  • Score
    100M100P100Q128214F
  • License ISC

Compat layer for running next.js apps in Lambda@Edge

Package Exports

  • @sls-next/next-aws-cloudfront

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sls-next/next-aws-cloudfront) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Next AWS CloudFront

Compat layer between next.js serverless page and CloudFront => Lambda@Edge.

Lambda@Edge event structure documentation can be found here.

Installation

npm install next-aws-cloudfront

Usage

const cloudFrontCompat = require("next-aws-cloudfront");
const page = require(".next/serverless/pages/somePage.js");

module.exports.render = async (event, context) => {
  const { req, res, responsePromise } = cloudFrontCompat(event.Records[0].cf);
  page.render(req, res);
  return responsePromise;
};