AWS
Reference

Every option that you can use in open-next.config.ts will be listed here. This is the configuration file that you can use to customize the build. You can look at the full example to see how you can use these options.

Servers here refers to all the different build outputs (Lambda, Node, Deno etc). Each server can have its own options. This also includes some server/function that only need to run at build time.

Each server config will be under it's own key in the config object. Here are all the servers that you can configure:

  • Default Server - Key: default This is the default server, similar to the server-function in open-next v2
  • Splitted Server - Key: functions This is only used if you want to split the server into multiple servers. This is a special case, under this key you will define every splitted server.
  • External middleware - Key: middleware If you want to deploy your middleware separately from the default servers or functions, you can use this key.
  • Revalidate Function - Key: revalidate This is a special server that will handle the revalidation queue.
  • Image Optimization Server - Key: imageOptimization This server will handle _next/image optimization.
  • Warmer Function - Key: warmer This server is meant to be used as a warmer for the lambda function.
  • Initialization Function - Key: initializationFunction This is a special server that will run at build time to initialize the cache. By default it only initialize the tag cache.

All these servers share some common options that you can use to customize them.

minify

This will try to minify the output of the server including node_modules. It is a boolean and by default, it is set to false. It could lead to some issues with some packages, so it is recommended to test your app with this option before deploying it.

We will likely not fix issues related to this option, as it is usually library specific.

override

This is where you will be able to override some part of the server. For all of them you can provide what we call a LazyLoadedOverride which is a function that will return the override. For some example look at some Custom overrides. All servers have some default override that you can override

TODO: Add all the types for the custom LazyLoadedOverride here. In the meantime, just look at the source file (opens in a new tab)


wrapper

This is the entrypoint of the server. Be aware that it might not be enough to change this to make it work on said platform. This is only the entrypoint, you might need to change other parts of the server to make it work on the platform.

Possible values are: aws-lambda, aws-lambda-streaming, node, cloudflare, dummy or a LazyLoadedOverride that will return the wrapper.

converter

This is the converter that will be used to convert the input and output for the server.

Possible values are: aws-apigw-v2, aws-apigw-v1, aws-cloudfront, edge, node, sqs-revalidate, dummy or a LazyLoadedOverride that will return the converter.

install

Install options for the server. This is used to install additional packages to this server

For image optimization, it will install sharp by default

packages - Mandatory

This is an array of packages that will be installed in the server. It is an array of string. Installing stuff on the default server (or one of the splitted one) might require some extra config on Next side to avoid duplicates

arch

This is the architecture of the server. It is a string and by default, it is set to x64.

Possible values are: x64, arm64

TODO: Add the other options and explain how to install packages on the default or splitted server functions