Major changes to NextjsSite
The NextjsSite
construct uses the @sls-next/lambda-at-edge package from the serverless-next.js project to build and package your Next.js app to a structure that can be deployed to Lambda@Edge and CloudFront.
Prior to this release, SST used to include the @sls-next/lambda-at-edge
package as a dependency. It caused two problems:
- You cannot use a different version of
@sls-next/lambda-at-edge
@sls-next/lambda-at-edge
is installed even if you are not using theNextjsSite
construct
Starting with this release, you are responsible for installing @sls-next/lambda-at-edge
as a dependency in your SST app to use the NextjsSite
construct.
What do I need to do
npm install -s @sls-next/lambda-at-edge
// or
yarn add @sls-next/lambda-at-edge
That's it! This should be a seamless transition for most people without any code changes. However, if you are hardcoding the bucket name, you need to change the name because this release will replace the bucket, and CloudFormation cannot replace it with the same name. For example, change this:
new NextjsSite(this, "Site", {
path: "path/to/src",
s3Bucket: {
bucketName: "my-bucket",
},
});
to
new NextjsSite(this, "Site", {
path: "path/to/src",
s3Bucket: {
bucketName: "my-new-bucket",
},
});
Update using:
$ npx sst update 0.63.0
$ yarn sst update 0.63.0