Interface NodejsFunctionProps

All Superinterfaces:
EventInvokeConfigOptions, FunctionOptions, software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
NodejsFunctionProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.91.0 (build 1b1f239)", date="2023-11-13T19:21:36.941Z") @Stability(Stable) public interface NodejsFunctionProps extends software.amazon.jsii.JsiiSerializable, FunctionOptions
Properties for a NodejsFunction.

Example:

 NodejsFunction.Builder.create(this, "my-handler")
         .bundling(BundlingOptions.builder()
                 .network("host")
                 .securityOpt("no-new-privileges")
                 .user("user:group")
                 .volumesFrom(List.of("777f7dc92da7"))
                 .volumes(List.of(DockerVolume.builder().hostPath("/host-path").containerPath("/container-path").build()))
                 .build())
         .build();
 
  • Method Details

    • getAwsSdkConnectionReuse

      @Stability(Stable) @Nullable default Boolean getAwsSdkConnectionReuse()
      Whether to automatically reuse TCP connections when working with the AWS SDK for JavaScript.

      This sets the AWS_NODEJS_CONNECTION_REUSE_ENABLED environment variable to 1.

      Default: true

      See Also:
    • getBundling

      @Stability(Stable) @Nullable default BundlingOptions getBundling()
      Bundling options.

      Default: - use default bundling options: no minify, no sourcemap, all modules are bundled.

    • getDepsLockFilePath

      @Stability(Stable) @Nullable default String getDepsLockFilePath()
      The path to the dependencies lock file (yarn.lock, pnpm-lock.yaml or package-lock.json).

      This will be used as the source for the volume mounted in the Docker container.

      Modules specified in nodeModules will be installed using the right installer (yarn, pnpm or npm) along with this lock file.

      Default: - the path is found by walking up parent directories searching for a `yarn.lock`, `pnpm-lock.yaml` or `package-lock.json` file

    • getEntry

      @Stability(Stable) @Nullable default String getEntry()
      Path to the entry file (JavaScript or TypeScript).

      Default: - Derived from the name of the defining file and the construct's id. If the `NodejsFunction` is defined in `stack.ts` with `my-handler` as id (`new NodejsFunction(this, 'my-handler')`), the construct will look at `stack.my-handler.ts` and `stack.my-handler.js`.

    • getHandler

      @Stability(Stable) @Nullable default String getHandler()
      The name of the exported handler in the entry file.

      The handler is prefixed with index. unless the specified handler value contains a ., in which case it is used as-is.

      Default: handler

    • getProjectRoot

      @Stability(Stable) @Nullable default String getProjectRoot()
      The path to the directory containing project config files (package.json or tsconfig.json).

      Default: - the directory containing the `depsLockFilePath`

    • getRuntime

      @Stability(Stable) @Nullable default Runtime getRuntime()
      The runtime environment.

      Only runtimes of the Node.js family are supported.

      Default: Runtime.NODEJS_18_X

    • builder

      @Stability(Stable) static NodejsFunctionProps.Builder builder()
      Returns:
      a NodejsFunctionProps.Builder of NodejsFunctionProps