Serverless reports configuration errors for 'alarms' property during validation
See original GitHub issueIssue Description
This is a Bug Report
Description
When running sls deploy
with a configuration that includes an alarms
property on a function, the service configuration validation process throws a Configuration error saying the property is unrecognised.
This error doesn’t seem to affect functionality - the specified alarms work when deployed.
It does prevent use of the stricter configValidationMode: error
, because deployments are aborted when errors are raised in that setup.
I don’t have experience writing serverless plugins, but there is documentation for extending the validation schema and it looks like the specific api is defineFunctionProperties.
For bug reports:
- What went wrong? A Configuration error is thrown.
- What did you expect should have happened? No errors should occur.
- What was the config you used? Relevant snippet:
plugins:
- serverless-plugin-aws-alerts
# ...
custom:
alerts:
topics:
critical:
alarm:
topic:
criticalalertsnstopic
nonCritical:
alarm:
topic:
notificationsnstopic
definitions:
criticalFunctionErrors:
namespace: 'AWS/Lambda'
metric: Errors
threshold: 20
statistic: Sum
period: 60
evaluationPeriods: 1
comparisonOperator: GreaterThanOrEqualToThreshold
alarmActions:
- critical
functionErrors:
alarmActions:
- nonCritical
functionThrottles:
alarmActions:
- nonCritical
alarms:
- functionErrors
- functionThrottles
-
# ...
myFunction:
name: my_function
handler: handlers.handle_my_function
alarms:
- criticalFunctionErrors
# ...
- What stacktrace or error message from your provider did you see?
Serverless Error ---------------------------------------
Configuration error:
at 'functions.myFunction': unrecognized property 'alarms'
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: darwin
Node Version: 12.14.1
Framework Version: 2.28.7 (local)
Plugin Version: 4.4.3
SDK Version: 2.3.2
Components Version: 3.7.2
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Configuration error at 'functions.hello': unrecognized property ...
7.0. Any properties not defined within function definition below will trigger validation error. serverless/lib/plugins/aws/provider/awsProvider.
Read more >Serverless Framework Deprecations
Starting with v4.0.0, Serverless will no longer recognize variablesResolutionMode , as supported configuration property. Drop it to avoid validation errors.
Read more >Environment variable validation error in AWS Serverless
Basically in my environment variable, there is the wrong format named _X_AMZN_TRACE_ID . It was not matching this pattern ...
Read more >Resolve model validation failed errors in CloudFormation - AWS
When I create a resource with AWS CloudFormation, I receive a "Model Validation Failed" error in my stack events.
Read more >Datadog Serverless Framework Plugin
You may encounter the error of missing type definitions. To resolve the error, add datadog-lambda-js and dd-trace to the devDependencies list of your...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey,
serverless.configSchemaHandler.defineFunctionProperties('aws', { properties: { alarms: { type: 'array' }, }, });
in index.js line 17 should fix this.Thanks @dhrrgn. I will release this.