aws-lambda - 无服务器获取本地函数列表

标签 aws-lambda serverless-framework serverless serverless-framework-offline

场景

我正在为本地 Lambda 输出编写单元测试。我想动态生成列表,而不是手动输入所有不同 lambda 函数的名称。

sls deploy list functions

将返回部署到 aws 的函数列表,但不返回本地无服务器环境中的函数列表

问题

如何获取本地函数列表?

帮助菜单对于如何运行本地函数很有用,但不适用于组装本地函数列表。
$ sls --help

Commands
* You can run commands with "serverless" or the shortcut "sls"
* Pass "--verbose" to this command to get in-depth plugin info
* Pass "--no-color" to disable CLI colors
* Pass "--help" after any <command> for contextual help

Framework
* Documentation: https://serverless.com/framework/docs/

config ........................ Configure Serverless
config credentials ............ Configures a new provider profile for the Serverless Framework
create ........................ Create new Serverless service
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
install ....................... Install a Serverless service from GitHub or a plugin from the Serverless registry
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
package ....................... Packages a Serverless service
plugin ........................ Plugin management for Serverless
plugin install ................ Install and add a plugin to your service
plugin uninstall .............. Uninstall and remove a plugin from your service
plugin list ................... Lists all available plugins
plugin search ................. Search for plugins
print ......................... Print your compiled and resolved config file
remove ........................ Remove Serverless service and all resources
rollback ...................... Rollback the Serverless service to a specific deployment
rollback function ............. Rollback the function to a specific version
slstats ....................... Enable or disable stats

Platform (Beta)
* The Serverless Platform is currently in experimental beta. Follow the docs below to get started.
* Documentation: https://serverless.com/platform/docs/

emit .......................... Emits an event to a running Event Gateway
login ......................... Login or sign up for the Serverless Platform
logout ........................ Logout from the Serverless Platform
run ........................... Runs the Event Gateway and the Emulator

最佳答案

serverless info

这给出了以下内容:
Service Information
service: <>
stage: <>
region: <>
stack: <>
api keys:
  <>
endpoints:
  <>
functions:
  <List of function names>

关于aws-lambda - 无服务器获取本地函数列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47356928/

相关文章:

aws-lambda - 如何在 Netlify lambda 函数之间共享代码

node.js - AWS Lambda : Sequelize acess denied error after accessing successfully the first time

android - 如何解决 {"message":"Missing Authentication Token"} 错误?

amazon-web-services - 您能否将 S3 存储桶触发器从以前的函数移至无服务器框架中的新函数?

swift - 无服务器和 alamofire "User is not authorized to access this resource"但与 postman 一起工作

yaml - 无服务器部署返回存储桶已存在

amazon-web-services - 不存在的导出/输出阻止堆栈更新/删除

.net-core - 如何登录到 Azure Functions 2.0 中的其他日志提供程序

amazon-web-services - 如何将用于写入Timestream数据的AWS lambda函数转换为写入多测量记录

android - AWS Lambda 中的错误处理