
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@effect-aws/lambda
Advanced tools
Clean way to write AWS Lambda handlers using Effect.
It provides a makeLambda function that takes an EffectHandler and returns a native promise Lambda handler function.
The implementation supports defining global runtime layer with graceful shutdown. So all finalizers defined by acquireRelease will be called on lambda downscaling.
npm install --save @effect-aws/lambda
Without dependencies:
import { Effect } from "effect"
import { EffectHandler, makeLambda, SNSEvent } from "@effect-aws/lambda"
// Define your effect handler
const myEffectHandler: EffectHandler<SNSEvent, never> = (event, context) => {
// Your effect logic here
return Effect.succeed("Hello, World!")
}
// Create the Lambda handler
export const handler = makeLambda(myEffectHandler)
With dependencies:
import { EffectHandler, makeLambda, SNSEvent } from "@effect-aws/lambda"
import * as Logger from "@effect-aws/powertools-logger"
import { Context, Effect, Layer } from "effect"
interface FooService {
bar: () => Effect.Effect<never, never, void>
}
const FooService = Context.Tag<FooService>()
const FooServiceLive = Layer.succeed(
FooService,
FooService.of({ bar: () => Logger.logInfo("Not implemented") })
)
// Define your effect handler with dependencies
const myEffectHandler: EffectHandler<SNSEvent, FooService> = (event, context) =>
Effect.gen(function* () {
yield* Logger.logInfo("Received event", { event, context })
const service = yield* FooService
return yield* service.bar()
})
// Create the global layer
const LambdaLive = Layer.provideMerge(
FooServiceLive,
Logger.DefaultPowerToolsLoggerLayer
)
// Create the Lambda handler
export const handler = makeLambda(myEffectHandler, LambdaLive)
Streaming:
import { S3 } from "@effect-aws/client-s3"
import { Handler, LambdaHandler } from "@effect-aws/lambda"
import { NodeStream } from "@effect/platform-node"
import { Cause, Effect, Stream } from "effect"
import { Readable } from "node:stream"
import { createGzip } from "node:zlib"
/**
* Streaming handler that reads a file from S3, compresses it using gzip, and
* returns the compressed data as a stream.
*/
const streamHandler = () => {
const stream = S3.getObject({
Bucket: "example-bucket",
Key: "file.txt"
}).pipe(
Effect.map((result) =>
NodeStream.fromReadable(
() => result.Body as Readable,
(e) => new Cause.UnknownException(e)
)
),
Stream.unwrap
)
return stream.pipe(
Stream.pipeThroughChannelOrFail(
NodeStream.fromDuplex(
() => createGzip(),
(e) => new Cause.UnknownException(e)
)
)
)
}
export const handler: Handler = LambdaHandler.stream({
handler: streamHandler,
layer: S3.defaultLayer
})
FAQs
Effectful AWS Lambda handler
We found that @effect-aws/lambda demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.