Run AWS Lambda to Lambda requests with openapi-client-axios
Installations
npm install openapi-lambda-adapter
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
18.20.5
NPM Version
10.8.2
Score
60.4
Supply Chain
91.1
Quality
76.5
Maintenance
100
Vulnerability
99.6
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (98.06%)
JavaScript (1.94%)
validate.email 🚀
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Developer
idanielbot
Download Statistics
Total Downloads
20,704
Last Day
28
Last Week
106
Last Month
444
Last Year
7,548
GitHub Statistics
MIT License
8 Stars
49 Commits
2 Forks
1 Watchers
4 Branches
3 Contributors
Updated on Jan 07, 2025
Bundle Size
26.42 kB
Minified
9.51 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.3.0
Package Id
openapi-lambda-adapter@1.3.0
Unpacked Size
37.30 kB
Size
11.29 kB
File Count
16
NPM Version
10.8.2
Node Version
18.20.5
Published on
Jan 07, 2025
Oops! Something went wrong.
Peer Dependencies
1
Dev Dependencies
27
openapi-lambda-adapter
JavaScript/Typescript library for making AWS Lambda to Lambda calls via openapi-client-axios .
Versioning
0.x to 1.x
- changed to AWS SDK v3 to reduce bundle size and allow the update to the Node 18 runtime
Features
- Easy to make API like calls via openapi-client-axios library.
1 client.api.registerRunner(getLambdaRunner('target-lambda-name'))
- Use your API clients from OpenAPI v3 definitions to make AWS Lambda to Lambda calls between your platform microservices.
client.getPet(1)
client.searchPets()
client.searchPets({ ids: [1, 2, 3] })
client.updatePet(1, payload)
- No need to run your requests via Api Gateway, you can directly run microservice to microservice call, i.e. AWS Lambda to Lambda, by leveraging AWS backbone infrastructure.
- Leverage AWS IAM for permission management. Eg:
1 Resources: 2 MyLambda: 3 Type: AWS::Serverless::Function 4 Properties: 5 ... 6 Policies: 7 - LambdaInvokePolicy: 8 FunctionName: target-lambda-name
Restrictions
- To run in AWS Lambda with Nodejs Runtime Environment >= 12
Quick Start
npm install --save openapi-client-axios openapi-lambda-adapter
Setup for single lambda handling all API Gateway requests
1import OpenAPIClientAxios from 'openapi-client-axios'; 2import { getLambdaRunner } from 'openapi-lambda-adapter'; 3 4const api = new OpenAPIClientAxios({ definition: 'https://example.com/api/openapi.json' }); 5const client = api.initSync(); 6client.api.registerRunner(getLambdaRunner('target-lambda-name')); 7 8const res = await client.createPet(null, { name: 'Garfield' }); 9console.log('Pet created', res.data);
Setup for multiple lambdas, each lambda handling one API Gateway resource
1import OpenAPIClientAxios from 'openapi-client-axios'; 2import { getLambdaRunner } from 'openapi-lambda-adapter'; 3 4const api = new OpenAPIClientAxios({ definition: 'https://example.com/api/openapi.json' }); 5const client = api.initSync(); 6client.api.getOperations().forEach((operation) => { 7 const lambdaName = ... get lambda-name for operationId 8 client.api.registerRunner(getLambdaRunner(lambdaName), operation.operationId) 9 }) 10 11const res = await client.createPet(null, { name: 'Garfield' }); 12console.log('Pet created', res.data); 13 14const resp = await client.getPet({ id: 1 }, null); 15console.log('Pet retrieved', resp.data);

No vulnerabilities found.

No security vulnerabilities found.