Handler overview
Added in v1.0.0
Table of contents
constructors
makeLambda
Makes a lambda handler from the given EffectHandler and optional global layer. The global layer is used to provide a runtime which will gracefully handle lambda termination during down-scaling.
Signature
export declare function makeLambda<T, E, A>(handler: EffectHandler<T, never, E, A>): Handler<T, A>
export declare function makeLambda<T, R, E1, E2, A>(
handler: EffectHandler<T, R, E1, A>,
globalLayer: Layer.Layer<R, E2>
): Handler<T, A>
Example
import { makeLambda } from "@effect-aws/lambda"
import { Context } from "aws-lambda"
import { Effect } from "effect"
const effectHandler = (event: unknown, context: Context) => {
return Effect.logInfo("Hello, world!")
}
export const handler = makeLambda(effectHandler)
Example
import { makeLambda } from "@effect-aws/lambda"
import { Context } from "aws-lambda"
import { Effect, Logger } from "effect"
const effectHandler = (event: unknown, context: Context) => {
return Effect.logInfo("Hello, world!")
}
const LambdaLayer = Logger.replace(Logger.defaultLogger, Logger.logfmtLogger)
export const handler = makeLambda(effectHandler, LambdaLayer)
Added in v1.0.0
model
EffectHandler (type alias)
Signature
export type EffectHandler<T, R, E = never, A = void> = (event: T, context: Context) => Effect.Effect<A, E, R>
Added in v1.0.0
Handler (type alias)
Signature
export type Handler<TEvent = unknown, TResult = any> = (event: TEvent, context: Context) => Promise<TResult>
Added in v1.0.0