ACloudGuru / serverless-plugin-aws-alerts

A Serverless Framework plugin that creates CloudWatch alarms for functions.
MIT License
531 stars 149 forks source link

Support for Serverless v2 #187

Open d-fay opened 3 years ago

d-fay commented 3 years ago

This is a Feature Proposal

Description

NPM warns of possible compatibility issue with Serverless v2

Everything appears to work with sls-v2. Packaging just needs updating. Alerts are still being created during deployment.

When running npm audit fix we see the following warning:

npm WARN serverless-plugin-aws-alerts@1.6.1 requires a peer of serverless@^1.12.0 but none is installed. You must install peer dependencies yourself.

Additional Data

Alerts continue to be correctly created in AWS, but NPM doesn't expect the plugin to work.

medikoo commented 3 years ago

@d-fay Latest version (v1.7.3) is configured to list servelress at v2:

https://github.com/ACloudGuru/serverless-plugin-aws-alerts/blob/v1.7.3/package.json#L42

Please upgrade

tomchiverton commented 2 years ago

I've done npm i serverless-plugin-aws-alerts serverless-mysql serverless

...
+ serverless-mysql@1.5.4
+ serverless-plugin-aws-alerts@1.7.4
+ serverless@2.64.1
added 630 packages from 391 contributors, updated 3 packages and audited 652 packages in 118.474s
...

yet still

$ sls deploy --aws-profile serverless-dev-extravision --stage live

  Type Error ---------------------------------------------

  TypeError: Cannot read property 'defineFunctionProperties' of undefined
      at new AlertsPlugin (/home/falken/workspace/serverless/bt-serverless-quiz/node_modules/serverless-plugin-aws-alerts/src/index.js:13:36)
      at PluginManager.addPlugin (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:84:28)
      at /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:121:31
      at Array.forEach (<anonymous>)
      at PluginManager.loadAllPlugins (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:121:8)
      at /usr/local/lib/node_modules/serverless/lib/Serverless.js:98:35

serverless.yml :

custom:
  alerts:
    stages:
      - live
    topics:
      alarm:
        topic: ${self:service}-${opt:stage}-alerts-alarm
        notifications:
          - protocol: email
            endpoint: foo@barr.com
  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              12.22.7
     Framework Version:         1.77.1
     Plugin Version:            3.6.18
     SDK Version:               2.3.1
     Components Version:        2.33.0
tomchiverton commented 2 years ago

Setting in package.json the plugin version to "1.6.1" fixes it