I was getting the below error while I was trying to deploy lambda on AWS.
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).
So, I upgraded the version of the serverless-plugin-warmup. now while I am trying to deploy the serverless lambda on AWS getting the below error. The plugin was working fine with node 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
Need some insight here, what is going wrong while deploying on AWS. The Script for deploy is
"deploy:staging": "cross-env NODE_ENV=staging sls deploy -s staging"
serverless.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
For the first error, try adding this to your serverless.yml file at the root level (same level as plugins, functions, and custom):
provider:
runtime: nodejs8.10
This should ensure your deployment runs in the proper runtime (globally). Alternatively, you can add the runtime setting under your lambda (same level as warmup) in order to choose runtimes individually.
For your second error, it is likely your "upgrade" didn't go well and you need to do another npm install. It's telling you that you have "serverless-plugin-warmup" specified, but it can't find it in your node_modules. It's possible you might have to delete your package-lock.json and/or your node_modules folder and do a fresh npm install. Make sure you have it listed in your package.json (npm i serverless-plugin-warmup -D
).