Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function main() {
const m = await faastAws(funcs, {
memorySize: 1728,
awsLambdaOptions: {
// chrome-aws-lambda only works with node8.10 for now.
Runtime: "nodejs8.10"
},
packageJson: {
dependencies: {
"chrome-aws-lambda": "latest",
"puppeteer-core": "latest"
}
}
});
try {
const rv = await m.functions.runPuppeteer("https://example.com");
console.log(rv.title);
writeFileSync("output.png", rv.screenshot);
async function main() {
const m = await faastAws(funcs, {
memorySize: 1728,
timeout: 60,
region: "us-west-1"
});
console.log(`## Logs`);
console.log(`${m.logUrl()}`);
try {
const result = await m.functions.hello("AWS");
console.log(`## Output`);
console.log(result);
console.log(`## Cost`);
const cost = await m.costSnapshot();
console.log(`${cost}`);
console.log(`## Stats`);
console.log(`${m.stats()}`);
} finally {
async function main() {
const m = await faastAws(funcs, {
memorySize: 1728,
timeout: 60,
region: "us-west-1"
});
console.log(`## Logs`);
console.log(`${m.logUrl()}`);
try {
const result = await m.functions.hello("AWS");
console.log(`## Output`);
console.log(result);
console.log(`## Cost`);
const cost = await m.costSnapshot();
console.log(`${cost}`);
console.log(`## Stats`);
console.log(`${m.stats()}`);
} finally {
export async function getFaastCompiler(
config: DuckConfig
): Promise> {
logger.info("Initializing batch mode");
const batch = assertNonNullable(config.batch);
const batchOptions = getBatchOptions(config);
const m =
batch === "aws"
? await faastAws(compilerFaastFunctions, batchOptions as AwsOptions)
: batch === "local"
? await faastLocal(compilerFaastFunctions, batchOptions as LocalOptions)
: null;
if (!m) {
throw new TypeError(`Unsupported batch mode: ${batch}`);
}
return m;
}