Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function invokeFunction(root, path) {
process.chdir(root);
const { handler } = require('hops-lambda/lambda');
return handler({ requestContext: { path }, path }, {}).then(response => {
if (response.isBase64Encoded) {
response.body = Buffer.from(response.body, 'base64').toString('utf-8');
}
return response;
});
}
async function zipFunctionCode(root) {
process.chdir(root);
const hopsConfig = require('hops-config');
const awsConfig = require('hops-lambda/lib/aws-config')(hopsConfig);
const tmpDir = await createTmpDirectory();
const lambdaZipFile = path.join(tmpDir, 'lambda.zip');
return createBundle(
root,
lambdaZipFile,
awsConfig.include,
awsConfig.exclude
);
}