尝试在 AWS 上部署 lambda 时出现以下错误。
Serverless Error ---------------------------------------
An error occurred: WarmUpPluginLambdaFunction - The runtime parameter of nodejs6.10 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs10.x) while creating or updating functions. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 5211b05e-0bd4-40d7-9555-9aac489053d0).
所以,我升级了 serverless-plugin-warmup 的版本。现在,当我尝试在 AWS 上部署无服务器 lambda 时,出现以下错误。该插件在节点 6.10 上运行良好
Serverless Error ---------------------------------------
Serverless plugin "serverless-plugin-warmup" not found. Make sure it's installed and listed in the "plugins" section of your serverless config file.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information -----------------------------
OS: linux
Node Version: 8.10.0
Serverless Version: 1.35.1
这里需要一些见解,在 AWS 上部署时出了什么问题。部署脚本是
"deploy:staging": "cross-env NODE_ENV=staging sls deploy -s staging"
- 我已将 serverless-plugin-warmup 版本从 3.0.0-rc.1 升级到 4.0.0-rc.1。
- 我已将 AWS 上的节点版本从 6.10 升级到 8.10
无服务器.yml
plugins:
- serverless-plugin-warmup
- serverless-offline
- serverless-domain-manager
- serverless-log-forwarding
custom:
warmup:
schedule: 'cron(0/10 12-23 ? * MON-FRI *)'
prewarm: true
functions:
myFunction:
warmup: ${self:provider.environment.CRON}
handler: handler.myFunction
events:
- http:
path: '{model}/{id}'
method: GET
authorizer: auth
cors:
origins:
- ${self:provider.environment.APP_DOMAIN}
headers: ${self:custom.headers}
allowCredentials: true