Skip to main content

boltctl serverless test

Test your serverless functions locally or after deploying it to the platform.

Usage

boltctl serverless test [flags]

Flags

  • -d, --base-dir string

    The base directory that contains the source code

  • -c, --config string

    Path to application configuration file

  • -f, --handler-file string

    The handler file to run

  • -u, --handler-function string

    Name of the handler function to call

  • -l, --language string

    Language the function is written in, ex: nodejs/20, python/3, golang/1.22, etc

  • --local

    Test the function only locally without deploying it to the remote. This is the default. Use --remote to test remotely. (default true)

  • -p, --port int

    The port to run the runtime interface on (default 8080)

  • --remote

    Perform tests after deploying the app/function to the remote instead of running it locally. The default is --local.

  • -r, --retain

    Retain all the files auto-generated during the test

Examples

To test a serverless function on your local machine:

boltctl serverless test

WARN no language specified, auto-detecting
Scanning source code
Detected a nodejs app
INFO starting local test server on http://localhost:8080
INFO Listening for events on port 8080 in development mode

You can now test this function by sending events to the endpoints on http://localhost:8080

Serverless test response to a get event

To test a serverless function remotely:

  • Currently this cannot be done from a local machine. Please deploy the app/function first to test it remotely. Refer Launch your application