How to use the faastjs.faastAws function in faastjs

To help you get started, we’ve selected a few faastjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github faastjs / examples / aws-puppeteer-ts / index.ts View on Github external
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);
github faastjs / examples / aws-js / index.js View on Github external
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 {
github faastjs / examples / aws-ts / index.ts View on Github external
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 {
github teppeis / duck / src / batch.ts View on Github external
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;
}