This document presents CLI redesigns planned for the future Serverless Framework v3.0. Our goal is to gather feedback from the community.
Here is a quick preview, complete examples are included below:
$ serverless deploy
Deploying myapp to stage dev (us-east-1)
✔ Service deployed to stack myapp-dev (31s)
endpoints: https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
functions:
index: myapp-dev-index (10 KB)
Toggle on monitoring with the Serverless Dashboard: run "serverless"
The goal of the redesign is to provide a better user experience with a simpler output and consistent design across all Serverless products.
For example, deploying is all about getting changes live. The most important information is not the deployment log but the application URL (or any other output).
On the other hand, the most important information for a failed deployment is the error itself.
We want to keep verbose information an option, but it should not be the default behavior.
Colors and styles should be consistent with other Serverless products. As such, CLI output formatting aims to be clear and minimalistic.
Usage of bold, italic, and underline should be exceptional.
Serverless is a single-color brand. Thus, colors are intentionally limited to:
#ffffff
#fd5750
#8c8d91
Use of other colors, including green, should be exceptional.
For terminals that do not support 16 million colors, ANSI basic red and gray colors should be used (even in 256 colors terminals).
Using red to highlight everything, including success, is intentional. It allows to match the Serverless branding while adding uniqueness to the CLI's identity.
That doesn't mean that success and error logs should display identically. With clear wording, symbols and appropriate amount of color, success and failures can be communicated clearly:
The examples below illustrate multiple scenarios. The left side shows the current CLI design. The right side shows the future CLI design.
$ serverless deploy
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service myapp.zip file to S3 (10.28 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
............................................
Serverless: Stack update finished...
Service Information
service: myapp
stage: dev
region: us-east-1
stack: myapp-dev
resources: 14
api keys:
None
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/foo
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/bar
functions:
foo: myapp-dev-foo
bar: myapp-dev-bar
layers:
None
Serverless: Removing old service artifacts from S3...
Toggle on monitoring with the Serverless Dashboard: run "serverless"
$ serverless deploy
Deploying myapp to stage dev (us-east-1)
✔ Service deployed to stack myapp-dev (31s)
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/foo
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/bar
functions:
foo: myapp-dev-foo (10 KB)
bar: myapp-dev-bar (10 KB)
Toggle on monitoring with the Serverless Dashboard: run "serverless"
Instead of printing all deployment steps to the output, the new design includes a spinner that refreshes in-place. As long as every step succeeds, the next step overrides the previous one, keeping the output as minimal as possible. Below is an illustration:
$ serverless deploy
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service myapp.zip file to S3 (10.28 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
.............
$ serverless deploy
Deploying myapp to stage dev (us-east-1)
{{ frames[frame] }} Packaging Uploading (222 KB) Updating CloudFormation stack Updating CloudFormation stack (1/9) Updating CloudFormation stack (3/9) Updating CloudFormation stack (6/9) ({{ 20 + second }}s)
$ serverless deploy
Serverless: Using provider credentials, configured via dashboard: https://app.serverless.com/vulcan/apps/kilo/kilo-backend/prod/us-east-1/providers
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service myapp.zip file to S3 (10.28 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
............................................
Serverless: Stack update finished...
Service Information
service: myapp
stage: dev
region: us-east-1
stack: myapp-dev
resources: 14
api keys:
None
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
functions:
publisher: myapp-dev-publisher
jobsWorker: myapp-dev-worker
layers:
None
Serverless: Removing old service artifacts from S3...
Serverless: Publishing service to the Serverless Dashboard...
Serverless: Successfully published your service to the Serverless Dashboard: https://app.serverless.com/myorg/apps/kilo/kilo-backend/prod/us-east-1
$ serverless deploy
Deploying myapp to stage dev (us-east-1, "main" provider)
✔ Service deployed to stack myapp-dev (31s)
dashboard: https://app.serverless.com/myorg/apps/kilo/kilo-backend/prod/us-east-1
functions:
publisher: myapp-dev-publisher (10 KB)
jobsWorker: myapp-dev-worker (10 KB)
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
When an application deploys a single "catch-all" API endpoint (for example an ExpressJS application),
we can simplify further by replacing the endpoints:
list with a single endpoint:
field.
$ serverless deploy
Deploying myapp to stage dev (us-east-1)
✔ Service deployed to stack myapp-dev (31s)
functions:
web: myapp-dev-web (10 KB)
endpoint: https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com
Toggle on monitoring with the Serverless Dashboard: run "serverless"
$ serverless deploy
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service myapp.zip file to S3 (10.28 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
......
Serverless: Operation failed!
Serverless: View the full error output: https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stack/detail?stackId=arn%3Aaws%3Acloudformation%3Aus-east-1%3A416566615250%3Astack%2Fmyapp-dev%2F26eca400-e881-11eb-8b2d-0edef5a02865
Serverless Error ----------------------------------------
An error occurred: HelloLambdaFunction - Resource handler returned message: "Value nodejs12.xa at 'runtime' failed to satisfy constraint: Member must satisfy enum value set: [nodejs12.x, python3.6, provided, nodejs14.x, ruby2.7, java11, go1.x, provided.al2, java8, java8.al2, dotnetcore3.1, python3.7, python3.8] or be a valid ARN
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 15.14.0
Framework Version: 2.52.1
Plugin Version: 5.4.3
SDK Version: 4.2.5
Components Version: 3.14.0
$ serverless deploy # without the Dashboard
Deploying myapp to stage dev (us-east-1)
✖ Stack myapp-dev failed to deploy (31s)
Environment darwin, node v15.14.0, framework v2.51.2, plugin v5.4.3, SDK v4.2.3 Credentials: Local credentials, "default" profile Docs: docs.serverless.com Support: forum.serverless.com Bugs: github.com/serverless/serverless/issues
Error:
UPDATE_FAILED: HelloLambdaFunction (AWS::Lambda::Function)
Resource handler returned message: "Value nodejs12.xa at 'runtime' failed to satisfy constraint: Member must satisfy enum value set: [java8, java11, nodejs10.x, nodejs12.x, python2.7, python3.6, python3.7, python3.8, dotnetcore2.1, go1.x, ruby2.5] or be a valid ARN.
View the full error: https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stack/detail?stackId=arn%3Aaws%3Acloudformation%3Aus-east-1%3A416566615250%3Astack%2Fmyapp-dev%2F8f271030-bbec-11eb-b27c-0a4ced5e22b5
$ serverless deploy # with the Dashboard
Deploying myapp to stage dev (us-east-1)
✖ Stack myapp-dev failed to deploy (31s)
Environment: darwin, node v15.14.0, framework v2.51.2, plugin v5.4.3, SDK v4.2.3 Credentials: Serverless Dashboard (https://app.serverless.com/myorg/apps/myapp/myapp/settings/providers) Docs: docs.serverless.com Support: forum.serverless.com Bugs: github.com/serverless/serverless/issues
Error:
UPDATE_FAILED: HelloLambdaFunction (AWS::Lambda::Function)
Resource handler returned message: "Value nodejs12.xa at 'runtime' failed to satisfy constraint: Member must satisfy enum value set: [java8, java11, nodejs10.x, nodejs12.x, python2.7, python3.6, python3.7, python3.8, dotnetcore2.1, go1.x, ruby2.5] or be a valid ARN.
View the full error: https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stack/detail?stackId=arn%3Aaws%3Acloudformation%3Aus-east-1%3A416566615250%3Astack%2Fmyapp-dev%2F8f271030-bbec-11eb-b27c-0a4ced5e22b5
$ serverless deploy # User error
Serverless Error ----------------------------------------
Configuration error at 'functions.hello.timeout': should be integer
Learn more about configuration validation here: http://slss.io/configuration-validation
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 15.14.0
Framework Version: 2.52.1
Plugin Version: 5.4.3
SDK Version: 4.2.5
Components Version: 3.14.0
$ serverless deploy # User error
Deploying myapp to stage dev (us-east-1)
✖ Stack myapp-dev failed to deploy (0s)
Environment darwin, node v15.14.0, framework v2.51.2, plugin v5.4.3, SDK v4.2.3 Credentials: Local credentials, "default" profile Docs: docs.serverless.com Support: forum.serverless.com Bugs: github.com/serverless/serverless/issues
Error:
Configuration error at 'functions.hello.timeout': should be integer
Learn more about configuration validation here: http://slss.io/configuration-validation
$ serverless deploy # Programmer error
Type Error ----------------------------------------
TypeError: Oh no, an internal error happened at Object.aws:package:finalize:addExportNameForOutputs [as hook] (/Users/serverless/lib/plugins/aws/package/index.js:91:15) at PluginManager.invoke (/Users/serverless/lib/classes/PluginManager.js:580:20) at PluginManager.spawn (/Users/serverless/lib/classes/PluginManager.js:602:16) at Object.package:finalize [as hook] (/Users/serverless/lib/plugins/aws/package/index.js:83:69) at PluginManager.invoke (/Users/serverless/lib/classes/PluginManager.js:580:20) at async PluginManager.spawn (/Users/serverless/lib/classes/PluginManager.js:602:5) at async /Users/serverless/scripts/serverless.js:803:9
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 15.14.0
Framework Version: 2.52.1
Plugin Version: 5.4.3
SDK Version: 4.2.5
Components Version: 3.14.0
$ serverless deploy # Programmer error
Deploying myapp to stage dev (us-east-1)
✖ Stack myapp-dev failed to deploy (0s)
Environment darwin, node v15.14.0, framework v2.51.2, plugin v5.4.3, SDK v4.2.3 Credentials: Local credentials, "default" profile Docs: docs.serverless.com Support: forum.serverless.com Bugs: github.com/serverless/serverless/issues
Error:
TypeError: Oh no, an internal error happened at Object.aws:package:finalize:addExportNameForOutputs [as hook] (/Users/serverless/lib/plugins/aws/package/index.js:91:15) at PluginManager.invoke (/Users/serverless/lib/classes/PluginManager.js:580:20) at PluginManager.spawn (/Users/serverless/lib/classes/PluginManager.js:602:16) at Object.package:finalize [as hook] (/Users/serverless/lib/plugins/aws/package/index.js:83:69) at PluginManager.invoke (/Users/serverless/lib/classes/PluginManager.js:580:20) at async PluginManager.spawn (/Users/serverless/lib/classes/PluginManager.js:602:5) at async /Users/serverless/scripts/serverless.js:803:9
Run again with the '--verbose' option to get more logs.
The errors shown above are fatal errors: the process stops because an error was thrown.
Some errors must not stop the process, for example (but not limited to) when running applications with serverless-offline. Here is what these errors would look like:
$ serverless offline # Non-fatal error
Serverless: Bundling with Webpack...
assets by status 0 bytes [cached] 1 asset ERROR in main Module not found: Error: Can't resolve './src' in '/Users/serverless/demo' resolve './src' in '/Users/serverless/demo' using description file: /Users/serverless/demo/package.json (relative path: .) using description file: /Users/serverless/demo/package.json (relative path: ./src) no extension /Users/serverless/demo/src doesn't exist .js /Users/serverless/demo/src.js doesn't exist .json /Users/serverless/demo/src.json doesn't exist .wasm /Users/serverless/demo/src.wasm doesn't exist as directory /Users/serverless/demo/src doesn't exist webpack compiled with 1 error in 129 ms Serverless: Watching for changes... ┌─────────────────────────────────────────────────────────────────────────┐ │ │ │ GET | http://localhost:3000/hello │ │ POST | http://localhost:3000/2015-03-31/functions/hello/invocations │ │ │ └─────────────────────────────────────────────────────────────────────────┘ [HTTP] server ready: http://localhost:3000 🚀
$ serverless offline # Non-fatal error
✖ Error in main Module not found: Error: Can't resolve './src' in '/Users/serverless/demo' resolve './src' in '/Users/serverless/demo' using description file: /Users/serverless/demo/package.json (relative path: .) using description file: /Users/serverless/demo/package.json (relative path: ./src) no extension /Users/serverless/demo/src doesn't exist .js /Users/serverless/demo/src.js doesn't exist .json /Users/serverless/demo/src.json doesn't exist .wasm /Users/serverless/demo/src.wasm doesn't exist as directory /Users/serverless/demo/src doesn't exist ┌─────────────────────────────────────────────────────────────────────────┐ │ │ │ GET | http://localhost:3000/hello │ │ POST | http://localhost:3000/2015-03-31/functions/hello/invocations │ │ │ └─────────────────────────────────────────────────────────────────────────┘ [HTTP] server ready: http://localhost:3000 🚀
$ serverless deploy
Serverless: WARNING: duplicate plugin some-plugin was not loaded
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service myapp.zip file to S3 (10.28 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
............................................
Serverless: Stack update finished...
Service Information
service: myapp
stage: dev
region: us-east-1
stack: myapp-dev
resources: 14
api keys:
None
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
functions:
publisher: myapp-dev-publisher
layers:
None
Serverless: Removing old service artifacts from S3...
Toggle on monitoring with the Serverless Dashboard: run "serverless"
$ serverless deploy
Warning: duplicate plugin some-plugin was not loaded
Deploying myapp to stage dev (us-east-1)
✔ Service deployed to stack myapp-dev (31s)
functions:
publisher: myapp-dev-publisher (10 KB)
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
Toggle on monitoring with the Serverless Dashboard: run "serverless"
$ serverless deploy
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service myapp.zip file to S3 (10.28 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
............................................
Serverless: Stack update finished...
Service Information
service: myapp
stage: dev
region: us-east-1
stack: myapp-dev
resources: 14
api keys:
None
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
functions:
publisher: myapp-dev-publisher
jobsWorker: myapp-dev-worker
layers:
None
Serverless: Removing old service artifacts from S3...
Serverless: Deprecation warnings:
Detected ".env" files. In the next major release variables from ".env" files will be automatically loaded into the serverless build process. Set "useDotenv: true" to adopt that behavior now.
More Info: https://www.serverless.com/framework/docs/deprecations/#LOAD_VARIABLES_FROM_ENV_FILES
Support for "package.include" and "package.exclude" will be removed with next major release. Please use "package.patterns" instead
More Info: https://www.serverless.com/framework/docs/deprecations/#NEW_PACKAGE_PATTERNS
Toggle on monitoring with the Serverless Dashboard: run "serverless"
$ serverless deploy
Deploying myapp to stage dev (us-east-1)
✔ Service deployed to stack myapp-dev (31s)
functions:
publisher: myapp-dev-publisher (10 KB)
jobsWorker: myapp-dev-worker (10 KB)
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
2 deprecations found: run 'serverless doctor' for more details
Toggle on monitoring with the Serverless Dashboard: run "serverless"
$ serverless doctor
2 deprecations triggered in the last command:
Detected ".env" files. In the next major release variables from ".env" files will be automatically loaded into the serverless build process. Set "useDotenv: true" to adopt that behavior now.
More Info: https://www.serverless.com/framework/docs/deprecations/#LOAD_VARIABLES_FROM_ENV_FILES
Support for "package.include" and "package.exclude" will be removed with next major release. Please use "package.patterns" instead
More Info: https://www.serverless.com/framework/docs/deprecations/#NEW_PACKAGE_PATTERNS
Interactive progresses are hidden and colors are disabled.
$ serverless deploy
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service myapp.zip file to S3 (10.28 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
............................................
Serverless: Stack update finished...
Service Information
service: myapp
stage: dev
region: us-east-1
stack: myapp-dev
resources: 14
api keys:
None
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
functions:
publisher: myapp-dev-publisher
jobsWorker: myapp-dev-worker
layers:
None
Serverless: Removing old service artifacts from S3...
Toggle on monitoring with the Serverless Dashboard: run "serverless"
$ serverless deploy
Deploying myapp to stage dev (us-east-1)
✔ Service deployed to stack myapp-dev (31s)
functions:
publisher: myapp-dev-publisher (10 KB)
jobsWorker: myapp-dev-worker (10 KB)
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
Toggle on monitoring with the Serverless Dashboard: run "serverless"
The normal output is very minimal. Using the --verbose
option prints all details.
An extra verbosity level is available via --debug
: this option prints verbose logs + internal Framework logs.
Preview of --verbose
:
$ serverless deploy --verbose
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service myapp.zip file to S3 (10.28 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
CloudFormation - UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - myapp-dev
CloudFormation - UPDATE_IN_PROGRESS - AWS::Lambda::Function - HelloLambdaFunction
CloudFormation - UPDATE_COMPLETE - AWS::Lambda::Function - HelloLambdaFunction
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - HelloLambdaVersionxo7mVIrb5qrFjIjhs7GmYITXR7zJ5sH0JkO8kC2tb4s
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - HelloLambdaVersionxo7mVIrb5qrFjIjhs7GmYITXR7zJ5sH0JkO8kC2tb4s
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Version - HelloLambdaVersionxo7mVIrb5qrFjIjhs7GmYITXR7zJ5sH0JkO8kC2tb4s
CloudFormation - UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - myapp-dev
CloudFormation - DELETE_SKIPPED - AWS::Lambda::Version - HelloLambdaVersion8XeTw8dmeCepXt2KSltXLxzAn2z8aH4w7yi4yX9Aq4
CloudFormation - UPDATE_COMPLETE - AWS::CloudFormation::Stack - myapp-dev
Serverless: Stack update finished...
Service Information
service: myapp
stage: dev
region: us-east-1
stack: myapp-dev
resources: 14
api keys:
None
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
functions:
publisher: myapp-dev-publisher
jobsWorker: myapp-dev-worker
layers:
None
Stack Outputs
HelloLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:416566615250:function:myapp-dev-hello:5
HttpApiId: wd6m3kwta5
ServerlessDeploymentBucketName: myapp-dev-serverlessdeploymentbucket-18gm15gzf8306
HttpApiUrl: https://wd6m3kwta5.execute-api.us-east-1.amazonaws.com
Serverless: Removing old service artifacts from S3...
Toggle on monitoring with the Serverless Dashboard: run "serverless"
$ serverless deploy --verbose
Deploying myapp to stage dev (us-east-1)
Packaging (3s)
Uploading (222 KB) (3s)
Updating CloudFormation stack (11s)
UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - myapp-dev
UPDATE_IN_PROGRESS - AWS::Lambda::Function - HelloLambdaFunction
UPDATE_COMPLETE - AWS::Lambda::Function - HelloLambdaFunction
CREATE_IN_PROGRESS - AWS::Lambda::Version - HelloLambdaVersionxo7mVIrb5qrFjIjhs7GmYITXR7zJ5sH0JkO8kC2tb4s
CREATE_IN_PROGRESS - AWS::Lambda::Version - HelloLambdaVersionxo7mVIrb5qrFjIjhs7GmYITXR7zJ5sH0JkO8kC2tb4s
CREATE_COMPLETE - AWS::Lambda::Version - HelloLambdaVersionxo7mVIrb5qrFjIjhs7GmYITXR7zJ5sH0JkO8kC2tb4s
UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - myapp-dev
DELETE_SKIPPED - AWS::Lambda::Version - HelloLambdaVersion8XeTw8dmeCepXt2KSltXLxzAn2z8aH4w7yi4yX9Aq4
UPDATE_COMPLETE - AWS::CloudFormation::Stack - myapp-dev
Service deployed to stack myapp-dev (31s)
functions:
publisher: myapp-dev-publisher (10 KB)
jobsWorker: myapp-dev-worker (10 KB)
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
Stack outputs:
HelloLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:416566615250:function:myapp-dev-hello:5
HttpApiId: wd6m3kwta5
ServerlessDeploymentBucketName: myapp-dev-serverlessdeploymentbucket-18gm15gzf8306
HttpApiUrl: https://wd6m3kwta5.execute-api.us-east-1.amazonaws.com
Toggle on monitoring with the Serverless Dashboard: run "serverless"
With v2.x, plugins log to the output using console.log()
or serverless.cli.log()
.
In v3, plugins can extend the structured output with new APIs.
The example below is inspired from a project using the following plugins: warmer, webpack, storage and domain manager.
$ serverless deploy
Serverless: Running "serverless" installed locally (in service node_modules)
Serverless: WarmUp: Creating warmer "officeHoursWarmer" to warm up 9 functions:
Serverless: * kilo-backend-prod-login
Serverless: * kilo-backend-prod-logout
Serverless: * kilo-backend-prod-providerAuth
Serverless: * kilo-backend-prod-providerLink
Serverless: * kilo-backend-prod-providerRefresh
Serverless: * kilo-backend-prod-userCreate
Serverless: * kilo-backend-prod-userDelete
Serverless: * kilo-backend-prod-userRead
Serverless: * kilo-backend-prod-userUpdate
Serverless: WarmUp: Creating warmer "outOfOfficeHoursWarmer" to warm up 9 functions:
Serverless: * kilo-backend-prod-login
Serverless: * kilo-backend-prod-logout
Serverless: * kilo-backend-prod-providerAuth
Serverless: * kilo-backend-prod-providerLink
Serverless: * kilo-backend-prod-providerRefresh
Serverless: * kilo-backend-prod-userCreate
Serverless: * kilo-backend-prod-userDelete
Serverless: * kilo-backend-prod-userRead
Serverless: * kilo-backend-prod-userUpdate
Serverless: Bundling with Webpack...
assets by path src/functions/ 349 KiB assets by path src/functions/user/ 42 KiB asset src/functions/user/create/handler.js 10.5 KiB [emitted] [minimized] (name: src/functions/user/create/handler) 1 related asset asset src/functions/user/update/handler.js 10.5 KiB [emitted] [minimized] (name: src/functions/user/update/handler) 1 related asset asset src/functions/user/read/handler.js 10.5 KiB [emitted] [minimized] (name: src/functions/user/read/handler) 1 related asset asset src/functions/user/delete/handler.js 10.5 KiB [emitted] [minimized] (name: src/functions/user/delete/handler) 1 related asset asset src/functions/refresh/handler.js 94.1 KiB [emitted] [minimized] (name: src/functions/refresh/handler) 1 related asset asset src/functions/auth/handler.js 94.1 KiB [emitted] [minimized] (name: src/functions/auth/handler) 1 related asset asset src/functions/link/handler.js 94.1 KiB [emitted] [minimized] (name: src/functions/link/handler) 1 related asset asset src/functions/logout/handler.js 10.4 KiB [emitted] [minimized] (name: src/functions/logout/handler) 1 related asset asset src/functions/login/handler.js 10.4 KiB [emitted] [minimized] (name: src/functions/login/handler) 1 related asset asset src/functions/admin/randomise/handler.js 3.57 KiB [emitted] [minimized] (name: src/functions/admin/randomise/handler) 1 related asset assets by path .warmup/ 5.46 KiB asset .warmup/outOfOfficeHoursWarmer/index.js 2.73 KiB [emitted] [minimized] (name: .warmup/outOfOfficeHoursWarmer/index) 1 related asset asset .warmup/officeHoursWarmer/index.js 2.73 KiB [emitted] [minimized] (name: .warmup/officeHoursWarmer/index) 1 related asset runtime modules 9.15 KiB 40 modules orphan modules 11 bytes [orphan] 1 module built modules 198 KiB [built] modules by path ./src/ 190 KiB modules by path ./src/libs/ 174 KiB 16 modules modules by path ./src/functions/ 6.31 KiB 4 modules modules by path ./src/util/*.ts 7.65 KiB 10 modules modules by path ./src/middleware/*.ts 1.34 KiB 4 modules ./src/resolvers/api-gateway.ts 280 bytes [built] [code generated] modules by path ./.warmup/ 7.5 KiB ./.warmup/officeHoursWarmer/index.js 3.75 KiB [built] [code generated] ./.warmup/outOfOfficeHoursWarmer/index.js 3.75 KiB [built] [code generated] modules by path external "@middy/ 84 bytes external "@middy/core" 42 bytes [built] [code generated] external "@middy/http-json-body-parser" 42 bytes [built] [code generated] WARNING in ./src/libs/user.ts 403:0-42 export 'UserData' (reexported as 'UserData') was not found in '@util/types' (possible exports: ) @ ./src/functions/login/handler.ts 2:0-30 8:20-30 WARNING in ./src/libs/user.ts 403:0-42 export 'UserSerialised' (reexported as 'UserSerialised') was not found in '@util/types' (possible exports: ) @ ./src/functions/login/handler.ts 2:0-30 8:20-30 webpack compiled with 2 warnings in 3341 ms (node:67778) [DEP_WEBPACK_CHUNK_MODULES_ITERABLE] DeprecationWarning: Chunk.modulesIterable: Use new ChunkGraph API (Use `node --trace-deprecation ...` to show where the warning was created) (node:67778) [DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API
Serverless: Package lock found - Using locked versions
Serverless: Packing external modules: @middy/core@1.5.2, @middy/http-json-body-parser@1.5.2, @sentry/serverless@6.6.0, @vulcancreative/serverless-storage@1.1.3, aws-sdk@2.884.0, source-map-support@0.5.19, bcryptjs@2.4.3, jsonwebtoken@8.5.1, uuid@3.3.2, validator@13.5.2, node-fetch@2.6.1
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless Storage: Storage already exists
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service myapp.zip file to S3 (10.28 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
Serverless: Stack update finished...
Service Information
service: myapp
stage: dev
region: us-east-1
stack: myapp-dev
resources: 14
api keys:
None
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
functions:
publisher: myapp-dev-publisher
jobsWorker: myapp-dev-worker
warmUpPluginOfficeHoursWarmer: myapp-dev-warmup-plugin-officeHoursWarmer
warmUpPluginOutOfOfficeHoursWarmer: myapp-dev-warmup-plugin-outOfOfficeHoursWarmer
layers:
None
Serverless Domain Manager: Info: Found apiId: r0oxfy319i for backend.kilo.ai
Serverless Domain Manager: Info: Updated API mapping from '' to '(none)' for backend.kilo.ai
Serverless Domain Manager: Summary: Distribution Domain Name
Serverless Domain Manager: Domain Name: backend.kilo.ai
Serverless Domain Manager: Target Domain: d-s7juq9wqf0.execute-api.us-east-1.amazonaws.com
Serverless Domain Manager: Hosted Zone Id: Z1UJRXOUMOOFQ8
Serverless: WarmUp: Prewarming up you functions using warmer "officeHoursWarmer".
Serverless: WarmUp: Warmer "officeHoursWarmer" successfully prewarmed your functions.
Serverless: Removing old service artifacts from S3...
Toggle on monitoring with the Serverless Dashboard: run "serverless"
$ serverless deploy
Deploying myapp to stage dev (us-east-1)
/* Note: some progress steps are detailed below for clarity, in reality they will dynamically show and hide */
⠋ [Webpack] Bundling with Webpack
⠋ [Webpack] Packing external modules
⠋ Packaging
⠋ ...
⠋ CloudFormation stack updating (9/9)
⠋ [Domain Manager] Updating API mapping from '' to '(none)' for backend.kilo.ai
⠋ [WarmUp] Warming using the "officeHoursWarmer" warmer
✔ Service deployed to stack myapp-dev (31s)
functions:
publisher: myapp-dev-publisher (10 KB)
jobsWorker: myapp-dev-worker (10 KB)
warmUpPluginOfficeHoursWarmer: myapp-dev-warmUpPluginOfficeHoursWarmer (10 KB)
warmUpPluginOutOfOfficeHoursWarmer: myapp-dev-warmUpPluginOutOfOfficeHoursWarmer (10 KB)
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
warmup plugin:
- officeHoursWarmer
- outOfOfficeHoursWarmer
domain manager:
domain name: backend.kilo.ai
target domain: d-s7juq9wqf0.execute-api.us-east-1.amazonaws.com
hosted zone id: Z1UJRXOUMOOFQ8
Toggle on monitoring with the Serverless Dashboard: run "serverless"
$ serverless deploy
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Service files not changed. Skipping deployment...
Service Information
service: myapp
stage: dev
region: us-east-1
stack: myapp-dev
resources: 14
api keys:
None
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
functions:
home: myapp-dev-home
layers:
None
Toggle on monitoring with the Serverless Dashboard: run "serverless"
$ serverless deploy
Deploying myapp to stage dev (us-east-1)
No changes to deploy. Deployment skipped.
Toggle on monitoring with the Serverless Dashboard: run "serverless"
Some tasks can execute in parallel, resulting in multiple spinners being displayed at the same time. Here is an example with parallel uploading:
$ serverless deploy
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service function1.zip file to S3 (10.28 KB)...
Serverless: Uploading service function2.zip file to S3 (32.11 KB)...
Serverless: Uploading service function3.zip file to S3 (12.78 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
.............
$ serverless deploy # multiple artifacts
Deploying myapp to stage dev (us-east-1)
{{ frames[frame] }} Uploading (0/3) (1/3) (2/3) ({{ 10 + second }}s)
{{ frames[frame] }} Uploading function1.zip to S3 (10 KB)
{{ frames[frame] }} Uploading function2.zip to S3 (32 KB)
{{ frames[frame] }} Uploading function3.zip to S3 (13 KB)
$ serverless deploy # single artifact
Deploying myapp to stage dev (us-east-1)
{{ frames[frame] }} Uploading (55 KB) ({{ 10 + second }}s)
$ serverless package
Serverless: Packaging service...
Serverless: Excluding development dependencies...
$ serverless package
Packaging myapp for stage dev
{{ frames[frame] }} Packaging ({{ second }}s)
✔ Service packaged (5s)
$ serverless deploy function -f hello
Serverless: Packaging function: hello
Serverless: Excluding development dependencies...
Serverless: Uploading function: hello (3.41 KB)...
Serverless: Successfully deployed function: hello
Serverless: Configuration did not change. Skipping function configuration update.
$ serverless deploy function -f hello
Deploying function hello to stage dev (us-east-1)
{{ frames[frame] }} Packaging ({{ second }}s)
{{ frames[frame] }} Uploading (3 KB) ({{ second }}s)
✔ Function code deployed (8s)
$ serverless info
Service Information
service: myapp
stage: dev
region: us-east-1
stack: myapp-dev
resources: 14
api keys:
None
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
functions:
publisher: myapp-dev-publisher
jobsWorker: myapp-dev-worker
layers:
None
$ serverless info
service: myapp
stage: dev
region: us-east-1
stack: myapp-dev
endpoints:
GET - https://3fr81y9fpa.execute-api.us-east-1.amazonaws.com/
functions:
publisher: myapp-dev-publisher (10 KB)
jobsWorker: myapp-dev-worker (10 KB)
$ serverless logs -f hello
START RequestId: 0da79ff0-8d8b-44e6-91c8-5e0ccbdac470 Version: $LATEST 2021-09-29 11:46:15.267 (+02:00) 953a16dd-b148-4aa6-a0bb-f1a1921e94ce INFO Hello world! END RequestId: 0da79ff0-8d8b-44e6-91c8-5e0ccbdac470 REPORT RequestId: 0da79ff0-8d8b-44e6-91c8-5e0ccbdac470 Duration: 2.56 ms Billed Duration: 3 ms Memory Size: 1024 MB Max Memory Used: 64 MB Init Duration: 158.78 ms
$ serverless logs -f hello
START RequestId: 0da79ff0-8d8b-44e6-91c8-5e0ccbdac470 Version: $LATEST
2021-09-29 11:46:15.267 (+02:00) 953a16dd-b148-4aa6-a0bb-f1a1921e94ce INFO Hello world!
END RequestId: 0da79ff0-8d8b-44e6-91c8-5e0ccbdac470
REPORT RequestId: 0da79ff0-8d8b-44e6-91c8-5e0ccbdac470 Duration: 2.56 ms Billed Duration: 3 ms Memory Size: 1024 MB Max Memory Used: 64 MB Init Duration: 158.78 ms
$ serverless --help
Commands
* You can run commands with "serverless" or the shortcut "sls" * Pass "--no-color" to disable CLI colors * Pass "--help" after any <command> for contextual help
Interactive Quickstart
* Run serverless (or shortcut sls) without any arguments to initialize an interactive setup of functionalities related to given service or current environment * Pass "--help-interactive" for contextual help on interactive CLI options
Serverless Components
* Run serverless (or shortcut sls) in context of a component service to initialize a components CLI * Pass "--help-components" for contextual help on Serverless Components
Framework
* Documentation: http://slss.io/docs
Environment Variables
* Set SLS_DEBUG=* to see debugging logs * Set SLS_WARNING_DISABLE=* to hide warnings from the output * Set SLS_DEPRECATION_DISABLE=* to disable deprecation logs * Set SLS_MAX_CONCURRENT_ARTIFACTS_UPLOADS to control the maximum S3 upload SDK requests that are sent in parallel during the deployment of the service's artifacts. The default is 3. Note: increasing this too high might, actually, downgrade the overall upload speed
General Commands
deploy ........................ Deploy a Serverless service
deploy function ............... Deploy a single function from the service
deploy list ................... List deployed version of your Serverless Service
deploy list functions ......... List all the deployed functions and their versions
info .......................... Display information about the service
invoke ........................ Invoke a deployed function
invoke local .................. Invoke function locally
logs .......................... Output the logs of a deployed function
metrics ....................... Show metrics for a specific function
remove ........................ Remove Serverless service and all resources
rollback ...................... Rollback the Serverless service to a specific deployment
rollback function ............. Rollback the function to the previous version
studio ........................ Develop a Serverless application in the cloud.
test .......................... Run HTTP tests
package ....................... Packages a Serverless service
plugin install ................ Install and add a plugin to your service
plugin uninstall .............. Uninstall and remove a plugin from your service
print ......................... Print your compiled and resolved config file
config ........................ Configure Serverless
config credentials ............ Configures a new provider profile for the Serverless Framework
config tabcompletion install .. Install a tab completion for chosen shell
config tabcompletion uninstall Uninstall a tab completion
create ........................ Create new Serverless service
dashboard ..................... Open the Serverless dashboard
generate-event ................ Generate event
install ....................... Install a Serverless service from GitHub or a plugin from the Serverless registry
login ......................... Login or sign up for Serverless
logout ........................ Logout from Serverless
output get .................... Get value of dashboard deployment profile parameter
output list ................... List all dashboard deployment profile parameters
param get ..................... Get value of dashboard service output
param list .................... List all dashboard deployment profile parameters
plugin list ................... Lists all available plugins
plugin search ................. Search for plugins
slstats ....................... Enable or disable stats
Plugins
ServerlessOffline, LiftPlugin
Commands by plugin
ServerlessOffline
offline ....................... Simulates API Gateway ...
LiftPlugin
lift eject .................... Eject Lift constructs to raw CloudFormation
$ serverless --help
Serverless Framework v3.0.0
Usage
serverless <command> <options>
sls <command> <options>
Documentation: http://slss.io/docs
Get started
Run serverless to interactively setup a project.
Use --help-interactive to display the interactive setup help.
Monitoring
Enable performance and error monitoring with the Serverless Dashboard.
Learn more: https://serverless.com/monitoring
Plugins
Extend the Serverless Framework with plugins.
Explore plugins: https://serverless.com/plugins
Options
-h, --help Display help for the given command --no-color Disable CLI colors --verbose Enables extra logging messages --version Display the framework version
Main commands
deploy Deploy a Serverless service deploy function Deploy a single function from the service info Display information about the service invoke Invoke a deployed function invoke local Invoke function locally logs Output the logs of a deployed function
Other commands
package Package a Serverless service remove Remove Serverless service and all resources deploy list List deployed version of your Serverless Service deploy list functions List all the deployed functions and their versions rollback Rollback the Serverless service to a specific deployment rollback function Rollback the function to the previous version test Run HTTP tests print Print your compiled and resolved config file generate-event Generate an AWS Lambda event config Configure Serverless dashboard Open the Serverless Dashboard login Login or sign up for the Serverless Dashboard logout Logout from the Serverless Dashboard output List and retrieve Serverless Dashboard outputs param List and retrieve Serverless Dashboard parameters plugin list Lists all available plugins plugin search Search for plugins plugin install Install and add a plugin to your service plugin uninstall Uninstall and remove a plugin from your service
ServerlessOffline commands
offline Simulates API Gateway ...
LiftPlugin commands
lift eject Eject Lift constructs to raw CloudFormation
$ serverless deploy list
Serverless: Listing deployments:
Serverless: -------------
Serverless: Timestamp: 1631541832701
Serverless: Datetime: 2021-09-13T14:03:52.701Z
Serverless: Files:
Serverless: - compiled-cloudformation-template.json
Serverless: - sls-demo-api.zip
Serverless: -------------
Serverless: Timestamp: 1631541937617
Serverless: Datetime: 2021-09-13T14:05:37.617Z
Serverless: Files:
Serverless: - compiled-cloudformation-template.json
Serverless: - sls-demo-api.zip
$ serverless deploy list
2021-09-13 14:03:52 UTC (1631541832701)
Files:
- compiled-cloudformation-template.json
- sls-demo-api.zip
2021-09-13 14:05:37 UTC (1631541937617)
Files:
- compiled-cloudformation-template.json
- sls-demo-api.zip
$ serverless deploy list functions
Serverless: Listing functions and their last 5 versions:
Serverless: -------------
Serverless: hello: 8, 9, 10, 11, 12
Serverless: world: 8, 9, 10, 11, 12
$ serverless deploy list functions
hello
Last 5 versions: 8, 9, 10, 11, 12
world
Last 5 versions: 8, 9, 10, 11, 12
$ serverless plugin list
@agiledigital/serverless-sns-sqs-lambda - Provide the lambda function with the snsSqs event, the plugin will add the AWS SNS topic and subscription, SQS queue and dead letter queue, and the role need for the lambda.
@digitalmaas/serverless-plugin-sqs-alarms - Simplifies the setup of CloudWatch Alarms to monitor the visible messages in an SQS queue.
...
To install a plugin run 'serverless plugin install --name plugin-name-here' It will be automatically downloaded and added to your package.json and serverless.yml file
$ serverless plugin list
@agiledigital/serverless-sns-sqs-lambda Provide the lambda function with the snsSqs event, the plugin will add the AWS SNS topic and subscription, SQS queue and dead letter queue, and the role need for the lambda.
@digitalmaas/serverless-plugin-sqs-alarms Simplifies the setup of CloudWatch Alarms to monitor the visible messages in an SQS queue.
...
Install a plugin by running: serverless plugin install --name <name> It will be automatically downloaded and added to package.json and serverless.yml
$ serverless plugin search -q serverless-lift
1 plugin(s) found for your search query "serverless-lift"
serverless-lift - Deploy high-level components such as static websites, buckets, queues, webhooks..
To install a plugin run 'serverless plugin install --name plugin-name-here' It will be automatically downloaded and added to your package.json and serverless.yml file
$ serverless plugin search -q serverless-lift
1 plugin(s) found matching "serverless-lift":
serverless-lift Deploy high-level components such as static websites, buckets, queues, webhooks..
Install a plugin by running: serverless plugin install --name <name> It will be automatically downloaded and added to package.json and serverless.yml
$ serverless plugin install --name=serverless-lift
Serverless: Creating an empty package.json file in your service directory
Serverless: Installing plugin "serverless-lift@latest" (this might take a few seconds...)
Serverless: Successfully installed "serverless-lift@latest"
$ serverless plugin install --name=serverless-lift
{{ frames[frame] }} Creating an empty package.json file ({{ second }}s)
{{ frames[frame] }} Installing plugin "serverless-lift" ({{ second }}s)
✔ Plugin "serverless-lift" installed (8s)
$ serverless plugin uninstall --name=serverless-lift
Serverless: Uninstalling plugin "serverless-lift" (this might take a few seconds...)
Serverless: Successfully uninstalled "serverless-lift"
$ serverless plugin uninstall --name=serverless-lift
{{ frames[frame] }} Uninstalling plugin "serverless-lift" ({{ second }}s)
✔ Plugin "serverless-lift" uninstalled (5s)
$ serverless login
Serverless: Logging you in via your default browser...
Serverless: If your browser does not open automatically, please open the URL: https://app.serverless.com?client=cli&transactionId=abcdefg
Serverless: You sucessfully logged in to Serverless.
Serverless: Please run 'serverless' to configure your service
$ serverless login
Logging in the Serverless Dashboard via the browser
If your browser does not open automatically, please open this URL: https://app.serverless.com?client=cli&transactionId=abcdefg
✔ You are now logged in the Serverless Dashboard
Run 'serverless' to add your service to the Serverless Dashboard
$ serverless logout
Serverless: You successfully logged out of Serverless.
$ serverless logout
✔ You are now logged out of the Serverless Dashboard
$ serverless param list
Serverless: Using provider credentials, configured via dashboard: https://app.serverless.com/abc/apps/sls-cli-design/sls-cli-design-api/prod/us-east-1/providers
Serverless: Stored parameters:
Name | Value
test | value
test2 | value2
$ serverless param list
test: value
test2: value2
$ serverless param get --name=test
Serverless: Using provider credentials, configured via dashboard: https://app.serverless.com/abc/apps/sls-cli-design/sls-cli-design-api/prod/us-east-1/providers
value
$ serverless param get --name=test
value
$ serverless output list
Serverless: Using provider credentials, configured via dashboard: https://app.serverless.com/abc/apps/sls-cli-design/sls-cli-design-api/prod/us-east-1/providers
Serverless: Stored outputs:
Name | Value
test | value
$ serverless output list
test: value
$ serverless output get --name=test
Serverless: Using provider credentials, configured via dashboard: https://app.serverless.com/abc/apps/sls-cli-design/sls-cli-design-api/prod/us-east-1/providers
value
$ serverless output get --name=test
value
$ serverless
What org do you want to add this service to? serverlessinc
What application do you want to add this to? (Use arrow keys)
❯ foo
bar
[Skip]
$ serverless
Onboarding myapp to the Serverless Dashboard
? What org do you want to add this service to? serverlessinc
? What application do you want to add this to? (Use arrow keys)
› foo
bar
[Skip]
$ serverless
What org do you want to add this service to? serverlessinc
What application do you want to add this to? [create a new app]
What do you want to name this application? test
Your project has been setup with org serverlessinc and app test
Do you want to deploy your project? Yes
Packaging succesful
⠇ Deploying your project. This might take a few minutes...
Deployment succesful
Your project is live
Run serverless deploy in the project directory Deploy your newly created service Run serverless info in the project directory after deployment View your endpoints and services Run serverless invoke and serverless logs in the project directory after deployment Invoke your functions directly and view the logs Run serverless in the project directory Add metrics, alerts, and a log explorer, by enabling the dashboard functionality
$ serverless
Onboarding myapp to the Serverless Dashboard
? What org do you want to add this service to? serverlessinc
? What application do you want to add this to? [create a new app]
? What do you want to name this application? test
✔ Service configured: deploy to publish it to the Serverless Dashboard
? Do you want to deploy now? Yes
✔ Service deployed to stack myapp-dev (31s)
What next?
Run these commands in the project directory:
serverless deploy Deploy changes serverless info View deployed endpoints and resources serverless invoke Invoke deployed functions serverless --help Discover more commands