UiPath Documentation
functions
latest
false
Functions user guide
  • Overview
    • About Functions
    • Licensing
  • JavaScript functions
    • Getting started
    • Building JavaScript functions
    • HTTP triggers and routing
    • Function context
    • Accessing platform services
    • Testing and debugging
  • Python functions
  • Deploy and run

Testing and debugging

Run JavaScript functions locally, call them over HTTP, execute one as a job, and validate the packaged project before publishing.

Functions run locally before they are packaged, against the same runtime and the same routing the platform uses.

Serve and call​

uip function serve
uip function serve

Starts a hot-reload server on port 7070; --port changes it. Every HTTP function is callable at its declared path, and the root URL lists the registered routes.

Call a served function with curl at its declared path:

curl -X POST http://localhost:7070/hello \
  -H "Content-Type: application/json" \
  -d '{"name":"Alice"}'
curl -X POST http://localhost:7070/hello \
  -H "Content-Type: application/json" \
  -d '{"name":"Alice"}'

serve also takes --runtime to choose the runtime, node or deno.

Run one as a job​

uip function run process-order --input '{"orderId":"A-1"}'
uip function run process-order --input '{"orderId":"A-1"}'

run runs the function once, the way the platform runs a job, and prints a JobResult with the status and the output arguments. It doesn't need serve. ctx.params and ctx.headers are empty, as in a deployed job. Use run to test job functions, and serve to test HTTP functions. Pass --input-file to read the input from a JSON file.

Reaching Orchestrator locally​

ctx.robot is null in a local run, and ctx.platform is built from environment variables. Put them in a .env file at the project root:

UIPATH_ACCESS_TOKEN=<your-access-token>
UIPATH_BASE_URL=https://cloud.uipath.com
UIPATH_ORG_ID=<org id>
UIPATH_TENANT_ID=<tenant id>
UIPATH_ACCESS_TOKEN=<your-access-token>
UIPATH_BASE_URL=https://cloud.uipath.com
UIPATH_ORG_ID=<org id>
UIPATH_TENANT_ID=<tenant id>

serve loads that file. Exporting the variables in your shell works too.

Running in production mode​

serve --production and run --production start the project the way the platform does, without hot reload. See the CLI reference for details.

Next steps​

Was this page helpful?

Connect

Need help? Support(opens in new window)

Want to learn? UiPath Academy(opens in new window)

Have questions? UiPath Forum(opens in new window)

Stay updated