UiPath Documentation
functions
latest
false
Guía del usuario de funciones
  • Información general
    • Acerca de las funciones
  • JavaScript functions
    • Primeros pasos
    • Building JavaScript functions
    • HTTP triggers and routing
    • Function context
    • Acceder a los servicios de la plataforma
    • Pruebas y depuración
  • Funciones de Python
  • Implementar y ejecutar
Importante :
Este contenido se ha traducido mediante traducción automática. La localización de contenidos recién publicados puede tardar entre una y dos semanas en estar disponible.

Pruebas y depuración

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 --function process-order --input '{"orderId":"A-1"}'
uip function run --function process-order --input '{"orderId":"A-1"}'

run executes the function once the way the platform runs a job, then prints a JobResult carrying the status and the output arguments. It does not need serve and makes no HTTP request, so ctx.params and ctx.headers are empty — the same conditions a deployed job function sees. Use it to test a function that declares no method and path.

Pass --entrypoint instead of --function to point at a file directly. One of the two is required.

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 automatically on both supported runtimes. Exporting the variables in your shell works too.

Validating the packaged project

serve --production and run --production reproduce a platform cold start: no hot reload, and the installed server runner is reused rather than rebuilt. Running the packed output this way surfaces the failures the platform would hit on deployment — most often a runtime dependency that was left in devDependencies. See the CLI reference for the full recipe.

Próximos pasos

¿Te ha resultado útil esta página?

Conectar

¿Necesita ayuda? Soporte

¿Quiere aprender? UiPath Academy

¿Tiene alguna pregunta? Foro de UiPath

Manténgase actualizado