Registry / devops / openapi-lambda-adapter

openapi-lambda-adapter

JSON →
library1.4.0jsnpmunverified

JavaScript/TypeScript library for making AWS Lambda to Lambda calls using openapi-client-axios. Current stable version is 1.4.0, active development. Provides a 'getLambdaRunner' function that wraps the AWS Lambda client to enable direct microservice-to-microservice invocations via OpenAPI operations, eliminating the need for API Gateway. Key differentiator: integrates with openapi-client-axios for type-safe API calls, supports IAM for permission management, and uses AWS SDK v3 for smaller bundle size. Requires Node.js >= 12.

npm install openapi-lambda-adapter
INSTALL
IMPORT
SIG · OPENAPI-LAMBDA-ADA
O
openapi-lambda-adapter
devopsjavascriptv1.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

getLambdaRunner
import { getLambdaRunner } from 'openapi-lambda-adapter'
const { getLambdaRunner } = require('openapi-lambda-adapter')
Package is ESM-only; using require() may fail in Node.js < 12 or without transpilation. TypeScript included.

Shows how to initialize openapi-client-axios with an OpenAPI definition and register a Lambda runner to make direct Lambda-to-Lambda calls.

import OpenAPIClientAxios from 'openapi-client-axios'; import { getLambdaRunner } from 'openapi-lambda-adapter'; const api = new OpenAPIClientAxios({ definition: 'https://example.com/api/openapi.json' }); const client = api.initSync(); client.api.registerRunner(getLambdaRunner('target-lambda-name')); const res = await client.createPet(null, { name: 'Garfield' }); console.log('Pet created', res.data);
Debug
Known issues
breakingSwith from AWS SDK v2 to v3 in version 1.x requires updating imports and configuration for Lambda client.
fix
Upgrade to v1.4.0 and use AWS SDK v3 (e.g., @aws-sdk/client-lambda).
affects: <1.0.0
gotchaMust define lambda invoke policy in IAM to allow the calling Lambda to invoke the target Lambda.
fix
Add LambdaInvokePolicy to the Lambda execution role, e.g., using SAM template: Policies: - LambdaInvokePolicy: FunctionName: target-lambda-name
affects: >=0.0.0
gotchaTarget Lambda must be in the same AWS account and region, and the function name is case-sensitive.
fix
Ensure the target function name matches exactly, including case, and that both functions are in the same account/region.
affects: >=0.0.0
gotchaopenapi-client-axios client initialization must be done before registering the Lambda runner.
fix
Call api.initSync() before client.api.registerRunner().
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'openapi-lambda-adapter'
Package not installed or missing from node_modules.
fix
Run 'npm install openapi-lambda-adapter' and ensure it's in package.json dependencies.
TypeError: getLambdaRunner is not a function
Incorrect import: using default import instead of named import.
fix
Use 'import { getLambdaRunner } from 'openapi-lambda-adapter'' instead of 'import getLambdaRunner from ...'
Error: Lambda invoke failed with error: AccessDeniedException
Calling Lambda does not have permission to invoke the target Lambda.
fix
Add IAM policy allowing lambda:InvokeFunction on the target Lambda ARN.
Upgrade
Version history
1.4.0latest on npm
Audit
Dependencies
@aws-sdk/client-lambdarequiredRequired to invoke Lambda functions directly via AWS SDK v3.
openapi-client-axiosrequiredPeer dependency; used for OpenAPI client initialization and operation handling.
Agent activity
10 hits · last 30 days
node
8
Amazon
1
Resources
openapi-lambda-adapter — npm install openapi-lambda-adapter · libregistry