Inputs

NameTypeDefault ValueDescription
domainArraynullFor example ['admin', 'portal.com']
bucketNamestringnullCustom bucket name where static assets are stored. By default is autogenerated.
bucketRegionstringus-east-1Region where you want to host your s3 bucket. Make sure this is geographically closer to the majority of your end users to reduce latency when CloudFront proxies a request to S3.
nextConfigDirstring./Directory where your application next.config.js file is. This input is useful when the serverless.yml is not in the same directory as the next app. Note: nextConfigDir should be set if next.config.js distDir is used
nextStaticDirstring./If your static or public directory is not a direct child of nextConfigDir this is needed
descriptionstring*lambda-type*@Edge for Next CloudFront distributionThe description that will be used for both lambdas. Note that "(API)" will be appended to the API lambda description.
policystringarn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRoleThe arn policy that will be assigned to both lambdas.
runtimestring\|objectnodejs12.xWhen assigned a value, both the default and api lambdas will be assigned the runtime defined in the value. When assigned to an object, values for the default and api lambdas can be separately defined
memorynumber\|object512When assigned a number, both the default and api lambdas will be assigned memory of that value. When assigned to an object, values for the default and api lambdas can be separately defined
timeoutnumber\|object10Same as above
handlerstringindex.handlerWhen assigned a value, overrides the default function handler to allow for configuration. Copies handler.js in route into the Lambda folders. Your handler MUST still call the default-handler afterwards or your function won't work with Next.JS
namestring\|object/When assigned a string, both the default and api lambdas will assigned name of that value. When assigned to an object, values for the default and api lambdas can be separately defined
buildboolean\|objecttrueWhen true builds and deploys app, when false assume the app has been built and uses the .next .serverless_nextjs directories in nextConfigDir to deploy. If an object is passed build allows for overriding what script gets called and with what arguments.
build.cmdstringnode_modules/.bin/nextBuild command
build.argsArray\|string['build']Arguments to pass to the build
build.cwdstring./Override the current working directory
build.enabledbooleantrueSame as passing build:false but from within the config
build.envobject{}Add additional environment variables to the script
cloudfrontobject{}Inputs to be passed to aws-cloudfront
domainTypestring"both"Can be one of: "apex" - apex domain only, don't create a www subdomain. "www" - www domain only, don't create an apex subdomain."both" - create both www and apex domains when either one is provided.
publicDirectoryCacheboolean\|objecttrueCustomize the public/static folder asset caching policy. Assigning an object with value and/or test lets you customize the caching policy and the types of files being cached. Assigning false disables caching
useServerlessTraceTargetbooleanfalseUse the experimental-serverless-trace target to build your next app. This is the same build target that Vercel Now uses. See this RFC for details.
verbosebooleanfalsePrint verbose output to the console.

Custom inputs can be configured like this:

myNextApp:
component: serverless-next.js
inputs:
bucketName: my-bucket