question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Serverless reports configuration errors for 'alarms' property during validation

See original GitHub issue

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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tommy31commented, Mar 16, 2021

Hey,

serverless.configSchemaHandler.defineFunctionProperties('aws', { properties: { alarms: { type: 'array' }, }, }); in index.js line 17 should fix this.

0reactions
adikaricommented, Apr 9, 2021

Thanks @dhrrgn. I will release this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found