如何解决无服务器框架WarmUp插件未被调用
我试图将WarmUp无服务器插件集成到我的项目中。但是,我认为它不起作用。我看不到lambda的CloudWatch日志组中的WarmUp调用,并且lambda在闲置了一段时间后确实需要预热时间。
我的配置如下:
perl -pi -e 's/(\d+)$/1+$1/e if $. == 1' ./document
lambda代码:
service: ${file(./${env:DEPLOY_FILE_NAME}):service}
provider:
name: aws
custom:
roleName: ${file(./${env:DEPLOY_FILE_NAME_STAGE}):roleName}
profileName: ${file(./${env:DEPLOY_FILE_NAME_STAGE}):profileName}
bundle:
ignorePackages:
- pg-native
warmup:
enabled: true
events:
- schedule: rate(5 minutes)
prewarm: true
plugins:
- pluginHandler
- serverless-plugin-warmup
runtime: nodejs12.x
iamRoleStatements:
- Effect: 'Allow'
Action:
- 'lambda:InvokeFunction'
Resource:
- Fn::Join:
- ':'
- - arn:aws:lambda
- Ref: AWS::Region
- Ref: AWS::AccountId
- function:${self:service}-${opt:stage,self:provider.stage}-*
cfLogs: true
stage: ${file(./${env:DEPLOY_FILE_NAME_STAGE}):stage}
region: ${file(./${env:DEPLOY_FILE_NAME_STAGE}):region}
memorySize: ${file(./${env:DEPLOY_FILE_NAME_STAGE}):memorySize}
timeout: ${file(./${env:DEPLOY_FILE_NAME_STAGE}):timeout}
keepWarm: false
useApigateway: true
package:
exclude:
${file(./${env:DEPLOY_FILE_NAME}):exclude}
functions:
lambdaHandler:
handler: ${file(./${env:DEPLOY_FILE_NAME_STAGE}):handler}
events:
${file(./${env:DEPLOY_FILE_NAME}):events}
warmup:
enabled: true
有什么可以检查的吗?任何建议/方向都将不胜感激。
谢谢
解决方法
首先,请从provider
移出插件
plugins:
- serverless-plugin-warmup
provider:
...
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。