Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const invoke = withRetries(chromeAwsLambdaRetries, 1000)(async payload => {
const lambda = new AWS.Lambda();
const params = {
FunctionName: chromeAwsLambdaFunctionName,
Payload: JSON.stringify(payload),
};
debug(`Invoking ${params.FunctionName} with ${params.Payload}`);
const data = await lambda.invoke(params).promise();
const response = JSON.parse(data.Payload);
if (response.errorMessage) {
throw parseError(response.errorMessage);
}
return response;
});