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 run build
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"
}
The status is maintenance after POST /off, and unavailable while a service is down.
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" \
-H "Authorization: Bearer <AUTH_KEY>" \
-d '{
"function": "hello",
"input": { "name": "Andera" },
"contract": 1
}'
Expected response:
{
"success": true,
"result": {
"message": "Hello Andera!"
}
}
Test MCP
After enabling MCP, connect a compatible client to http://localhost:3000/mcp with the header Authorization: Bearer <MCP_AUTH_KEY>, list tools and call hello. REST uses AUTH_KEY; the MCP token is separate. A 404 with MCP is disabled means the token was rejected at startup (see the logs) or mcp.json is missing or unreadable.
Troubleshooting
- Worker exits at startup: The configuration is validated at startup; the error message names the invalid variable. See Configuration.
- Port already in use: Make sure no other process is using port 3000.
- 401 Unauthorized: Check your
AUTH_KEYand use the correct header. - Function not found: Ensure your function file exists in
src/functions/with the right definition. - Not discovered by the Load Balancer:
LB_AUTH_KEYmust be identical on the Load Balancer and the Worker, and the Load Balancer must reach both the HTTP and WebSocket ports. - No response: Check console for errors.