Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@alpha-lambda/handler
Advanced tools
Tiny wrapper that ensures that AWS Lambda function's callback is always called. In other words, from your handler you can return value, promise, throw exception, and this library will wrap your code into a promise while calling appropriate lambda-required callback. Your handler is composed of middleware, similar to Express or Koa.
$ npm install @alpha-lambda/handler
const handler = require('@alpha-lambda/handler');
const pino = require('pino');
module.exports.handler = handler()
.use(async (event, context, next) => {
// this is some middleware
// this will forward to next function in the chain
await next();
// you can do things, like logging, after the fact
// you can also override the return value
})
.with({
log: pino() // this will be accessible as context.log
})
.use((event, context) => {
context.log.info({ event }, 'incoming event');
return 'Hello, world!';
});
Adds middleware of the function(event, context, next) {}
form to the chain.
Adds extensions to the context. Extensions are grouped into sections. If context has a section already, new keys will be merged in, but will not override existing ones.
The next()
function takes up to three arguments: (err, context, event)
.
If you specify err
, then execution is rejected with it. You can also (optionally) specify context/event to override those values for subsequent middleware.
Examples:
next(); // no err, no override for context/event
next(new Error('failure!')); // rejected with Error
next(null, {}); // context is overriden
next(null, null, {}); // event is overriden
next(null, {}, {}); // both context and event are overriden
Use these middleware to extend functionality.
Middleware | Author |
---|---|
Bunyan Logger Bunyan logger middleware for alpha-lambda | Anton Bazhal |
The MIT License (MIT)
Copyright (c) 2016-2019 Anton Bazhal
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Middleware pipeline for AWS Lambda handlers
The npm package @alpha-lambda/handler receives a total of 501 weekly downloads. As such, @alpha-lambda/handler popularity was classified as not popular.
We found that @alpha-lambda/handler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.