UNPKG

@gravitywelluk/aws

Version:

Library of commonly used AWS wrapper functions to communicate with the AWS SDK

26 lines (25 loc) 877 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.invokeLambda = void 0; const lambda_configure_1 = require("./lambda-configure"); const utils_1 = require("../utils"); /** * Invokes a Lambda function. * * You can invoke a function synchronously (and wait for the response), * or asynchronously. To invoke a function asynchronously, * set InvocationType to Event. * * @param invokeParams - The Lambda invoke params * @param awsLambdaConfigOverrides - Configuration option overrides */ const invokeLambda = async (invokeParams, awsLambdaConfigOverrides = {}) => { const lambda = (0, lambda_configure_1.lambdaConfigure)(awsLambdaConfigOverrides); try { return await lambda.invoke(invokeParams).promise(); } catch (error) { throw new utils_1.AwsError(error); } }; exports.invokeLambda = invokeLambda;