开发者社区> 镜像站> NPM> @perform/lambda-powertools-middleware-log-timeout
@perform/lambda-powertools-middleware-log-timeout

Middy middleware to log an error message when a function times out.

Moved to @dazn/lambda-powertools-middleware-log-timeout - please migrate to the new package by Tuesday 20th August 2019 as this package will be made private.
Last updated a year ago by automation-drone .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @perform/lambda-powertools-middleware-log-timeout 
SYNC missed versions from official npm registry.

lambda-powertools-middleware-log-timeout

A Middy middleware that will log a timeout error message just before the function actually times out.

Main features:

  • records an error log message invocation timed out (with the invocation event as attribute) when an invocation times out

Getting Started

Install from NPM: npm install @perform/lambda-powertools-middleware-log-timeout

Alternatively, if you use the template @perform/lambda-powertools-pattern-basic then this would be configured for you.

API

The middleware accepts an optional constructor parameter thresholdMillis, which is the number of millis before an invocation is timed out, that an error message is logged. thresholdMillis defaults to 10ms.

const middy = require('middy')
const logTimeout = require('@perform/lambda-powertools-middleware-log-timeout')

const handler = async (event, context) => {
  return 42
}

module.exports = middy(handler)
  // or .use(logTimeout(50)) to log the timeout error message 50ms before invocation times out
  .use(logTimeout()) // defaults to 10ms
}

It's recommended that you use the @perform/lambda-powertools-pattern-basic which configures this middleware along with other useful middlewares.

Current Tags

  • 1.8.0                                ...           latest (a year ago)

4 Versions

  • 1.8.0 [deprecated]           ...           a year ago
  • 1.5.0 [deprecated]           ...           a year ago
  • 1.4.2 [deprecated]           ...           a year ago
  • 1.3.0 [deprecated]           ...           a year ago
Maintainers (326)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (1)