@oidc-exchange/lambda
v0.4.1
Published
AWS Lambda adapter for oidc-exchange - handles API Gateway, ALB, and Function URL events
Readme
@oidc-exchange/lambda
AWS Lambda adapter for oidc-exchange. It wraps @oidc-exchange/node and translates Lambda HTTP events into requests for the embedded token-exchange service — automatically detecting API Gateway v1, API Gateway v2 / Function URL, and ALB event shapes.
Install
npm install @oidc-exchange/lambda @oidc-exchange/node@oidc-exchange/node is a peer dependency (it carries the native binary). Requires Node.js ≥ 22.
Usage
import { createHandler } from "@oidc-exchange/lambda";
export const handler = createHandler({
config: "./config.toml",
basePath: "/auth", // optional: strip a stage/route prefix before routing
});Inline configuration instead of a file:
export const handler = createHandler({
configString: `
[server]
issuer = "https://auth.example.com"
…
`,
});createHandler(options) returns an async (event, context) => result handler. options are the same as OidcExchange (config / configString) plus an optional basePath.
Configuration behaviour change
Handler construction now fails when a ${VAR} placeholder is unresolved, empty, or malformed
instead of using that placeholder as literal configuration text. Set every referenced environment
variable in the Lambda runtime before calling createHandler.
Deploy
See the AWS Lambda deployment guide and the Lambda example. The same service also runs as a long-lived server — see the main repository.
Links
Published from CI with npm provenance. MIT licensed.
