Skip to main content Link Search Menu Expand Document (external link)

Runtime overview

Added in v1.0.0


Table of contents


constructors

fromLayer

Makes a runtime from a layer asynchronously, designed for AWS Lambda. All finalizers will be executed on process termination or interruption.

Signature

export declare const fromLayer: <R, E>(layer: Layer.Layer<R, E, never>) => Promise<Runtime<R>>

Example

import { fromLayer } from "@effect-aws/lambda"
import { Context } from "aws-lambda"
import { Effect, Logger, Runtime } from "effect"

const LambdaLayer = Logger.replace(Logger.defaultLogger, Logger.logfmtLogger)

const lambdaRuntime = fromLayer(LambdaLayer)

export const handler = async (event: unknown, context: Context) => {
  const runPromise = Runtime.runPromise(await lambdaRuntime)
  return Effect.logInfo("Hello, world!").pipe(runPromise)
}

Added in v1.0.0