1.0.4 • Published 28 days ago

@growsari/invoke-lambda v1.0.4

Weekly downloads
23
License
ISC
Repository
-
Last release
28 days ago

Invoke Lambda Package

Utility function for calling microservices within APIs.

Usage

const invokeLambda = require('@growsari/invoke-lambda')

await invokeLambda('ms-some-project', 'create', { name: 'some-name', description: 'some-value'})

You may specify the API version and the region as named parameters after params. They will default to '2015-03-31' and process.env.AWS_DEFAULT_REGION respectively, if not defined.

Async

await invokeLambda('ms-some-project', 'create', { name: 'some-name', description: 'some-value'}, {async: true})

You can specify {async: true} to execute lambda asynchronously.

Details

Invokes the lambda named [service]-[stage]-[operation].

Assumptions

  • process.env.AWS_DEFAULT_REGION is named in the project.
  • process.env.IS_OFFLINE is true when deployed.
  • When in offline mode, it is deployed through Docker deployment.
  • process.env[``${service.toUpperCase()}-PORT``] is assigned to the deployment port of the specific service in the Docker deployment.
  • The containing lambda has access to all of the lambdas named.
  • Called function response has the following payload format
{
  data: Object,
  success: Boolean,
  message: String,
  code: any
}

so that the response will be identified properly as a success or a failure.

Errors

CodeMessage
INVOKE-001Invalid lambda function 'function_name'
INVOKE-002Error executing lambda 'function_name'
1.0.4

28 days ago

1.0.3

2 months ago

1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago

0.0.21

3 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago