Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dazn/lambda-powertools-middleware-log-timeout

Package Overview
Dependencies
Maintainers
7
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dazn/lambda-powertools-middleware-log-timeout

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

  • 1.29.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
435
decreased by-55.02%
Maintainers
7
Weekly downloads
 
Created
Source

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 @dazn/lambda-powertools-middleware-log-timeout

Alternatively, if you use the template @dazn/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('@dazn/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 @dazn/lambda-powertools-pattern-basic which configures this middleware along with other useful middlewares.

FAQs

Package last updated on 04 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc