如何在本地为无服务器脱机设置ssm参数



我最近开始研究无服务器架构。下面是serverless.xml的示例。

test:
name: test
handler: handler.lambda_handler
timeout: 6
environment:
APP_ID: ${ssm:/path/to/ssm/test~true}

现在,当我尝试运行无服务器脱机命令时,它会抱怨ssm变量。以下是控制台上出现的错误。

我想在我的本地机器上运行一切以进行开发。有人能帮我解决这个问题吗。

ServerlessError: Trying to populate non string value into a string for variable ${ssm:/path/to/ssm/test~true}. Please make sure the value of the property is a string.
at Variables.populateVariable (C:UserskumarnAppDataRoamingnpmnode_modulesserverlesslibclassesVariables.js:464:13)
at Variables.renderMatches (C:UserskumarnAppDataRoamingnpmnode_modulesserverlesslibclassesVariables.js:386:21)
at C:UserskumarnAppDataRoamingnpmnode_modulesserverlesslibclassesVariables.js:406:29
From previous event:

您可以通过添加插件来解决此问题:

https://github.com/janders223/serverless-offline-ssm

如果你觉得更冒险,你也可以使用localstackhttps://github.com/localstack/localstack

注意,免费版本并不支持所有

最新更新