Skip to content

runWith

Franklin Chieze edited this page Oct 16, 2020 · 3 revisions
runWith(runtimeOptions: RuntimeOptions)

The runWith decorator is an auxiliary decorator that specifies the runtime options a function should run with.

parameters

  • runtimeOptions
    This is a RuntimeOptions parameter that specifies options a function should run with.
interface RuntimeOptions {
    failurePolicy?: FailurePolicy | boolean;
    memory?: Memory;
    maxInstances?: number;
    timeoutSeconds?: number;
    vpcConnector?: string;
    vpcConnectorEgressSettings?: VpcConnectorEgressSettings
}

export type FailurePolicy = {
    retry: {}
}

export type Memory = "128MB" | "256MB" | "512MB" | "1GB" | "2GB";

export type VpcConnectorEgressSettings = "VPC_CONNECTOR_EGRESS_SETTINGS_UNSPECIFIED" | "PRIVATE_RANGES_ONLY" | "ALL_TRAFFIC";

example

import { func, runWith, onHttpsRequest } from 'firefuncs';

export class Records {
    @func()
    @runWith({ memory: '2GB' })
    @onHttpsRequest()
    public async hello(req, res) {
        res.send('Hello World!');
    }
}