Verifying Lambdas


Lambdas can be difficult to debug in remote environments. To make this easier, I always look to have them support the following params:

verbose — add to the output a summary of what was done, e.g. entities processed, items skipped, etc.

dry — simulate execution without side effects

// accepted by the lambda
type BaseLambdaOptions = {
  verbose?: boolean
  dry?: boolean
}

// output by the lambda
type VerboseResponse = {
  verboseLog?: string
}

From an admin or debug tool, allow manual invocation of all lambdas, defaulting to verbose=true, and optionally dry=true.