When performing a deploy from a folder generated by running package separately, and specifying monitors in the configuration, the plugin should ensure that the DATADOG_API_KEY and DATADOG_APP_KEY are in the environment.
Actual Behavior
Because the checks for existence of DATADOG_API_KEY and DATADOG_APP_KEY are in the handler attached to lifecycle events that are not triggered for a deploy executed like this, the validation doesn't occur. This causes the monitors code to fail silently.
Expected Behavior
When performing a
deploy
from a folder generated by runningpackage
separately, and specifying monitors in the configuration, the plugin should ensure that theDATADOG_API_KEY
andDATADOG_APP_KEY
are in the environment.Actual Behavior
Because the checks for existence of
DATADOG_API_KEY
andDATADOG_APP_KEY
are in the handler attached to lifecycle events that are not triggered for a deploy executed like this, the validation doesn't occur. This causes the monitors code to fail silently.https://github.com/DataDog/serverless-plugin-datadog/blob/08dfe3b4c69e667f0c0b595c1ea2111d3048f430/src/index.ts#L114
Steps to Reproduce the Problem
sls package
specifyingDATADOG_API_KEY
andDATADOG_APP_KEY
in the environment.sls deploy --package .serverless
without specifyingDATADOG_API_KEY
andDATADOG_APP_KEY
in the environment.Specifications