【问题标题】:Serverless get list of local functions无服务器获取本地函数列表
【发布时间】:2019-09-07 07:48:48
【问题描述】:

场景

我正在为本地 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

【问题讨论】:

  • 你有没有得到任何地方?
  • @RMK 我们最终切换到SAM local,这对整个团队来说效果更好。 GL!

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


【解决方案1】:
serverless info

这给出了以下内容:

Service Information
service: <>
stage: <>
region: <>
stack: <>
api keys:
  <>
endpoints:
  <>
functions:
  <List of function names>

【讨论】:

  • 你的自我回答对我有用!请将您自己的答案标记为正确的。
  • 我和问问题的人不同。
  • 这仅适用于远程功能,不适用于本地功能
猜你喜欢
  • 2021-09-07
  • 1970-01-01
  • 2021-01-29
  • 1970-01-01
  • 2017-07-02
  • 1970-01-01
  • 2018-07-24
  • 2020-06-08
  • 1970-01-01
相关资源
最近更新 更多