AWS
Overrides
Wrapper

This is the main entrypoint of the server. It is used for every server and allow you to run either in serverless mode or as a long running server.

If you want to better understand how to implement your own Wrapper, the easiest way would be to take a look at one of the existing included Wrapper (opens in a new tab).

Couple of things to note :

  • If you want to use streaming (for the node runtime of next), you'll need to create a StreamCreator and pass it to the handler. You can find some example in the node (opens in a new tab) or aws-lambda-streaming (opens in a new tab) wrapper.
  • If you don't use streaming (like in the default aws-lambda wrapper), you may still need to provide a fake StreamCreator to the handler to avoid a weird issue with Node itself (see here (opens in a new tab) for an example and a more thorough explanation).
  • If you use the edge runtime of Next (either for the external middleware or for an edge route or page), you don't need the StreamCreator at all.
  • If you are in a serverless environment and it supports waitUntil, you should define it here(see here (opens in a new tab)). This might not be necessary depending on where you run it (for example the aws-lambda-streaming or the node wrapper doesn't need it.)