Test your Worker
This page explains how to test your Base Worker after installation and configuration, to ensure it is running and responding as expected.
Start the Worker
Make sure your Worker is running locally (default port: 3000
):
npm start
Or, if using Docker:
docker network create andera-net
docker-compose build
docker-compose up
Health Check
Test the health endpoint to verify the Worker is up:
curl http://localhost:3000/health
Expected response:
{
"status": "ready"
}
tip
The /health
endpoint displays more useful information when authenticated with the Authorization
header:
curl -H "Authorization: <AUTH_KEY>" http://localhost:3000/health
Test a Function
Call a function (e.g., hello
, which is available by default on the Base Worker) using the /task
endpoint:
curl -X POST http://localhost:3000/task \
-H "Content-Type: application/json" \
-d '{
"function": "hello",
"input": { "name": "Andera" },
"contract": 1
}'
Expected response:
{
"success": true,
"result": {
"message": "Hello Andera!"
}
}
Troubleshooting
Common Issues
- Port already in use: Make sure no other process is using port 3000.
- 401 Unauthorized: Check your
AUTH_KEY
and use the correct header. - Function not found: Ensure your function file exists in
src/functions/
with the right definition. - No response: Check console for errors.