Running jobs and commands
Running Commands¶
Apps with Commands¶
Commands exists in the following projects, I have written the relative path base from root of "customoffice" repo.
- dist/apps/api-server
- dist/apps/scripts
- dist/apps/task-runner
Running Commands¶
Change directory into the given dist/apps/(project) directory, where the desired command is located. To see how it runs check http://127.0.0.1:5342/ in browser, what commands output is very individual between commands.
cd dist/apps/task-runner
USER=customoffice DATABASE_NAME=econ node main.js read-tasks-to-expected-invoices
Beware commands when run does not terminate. So you need terminate command with Ctrl+C, when you expect the command to be done. Should be fixed with this PR #4559
Running TS Commands¶
There is another type of commands. To run these commands, change directory to root of repo "customoffice". Some command do require env's to be set, check the given command for whats required.
npx tsx --tsconfig tsconfig.base.json \
libs/feature/economy-system-integration/backend/data/e-conomic/e-conomic-integration/src/lib/interactive-test/create-department.ts \
--help
Running Jobs¶
When commands are added as jobs, Jobs are not defined in kebab-case but changed to camel-case. It also assumes that you have your task-runner running. To see how it runs check http://127.0.0.1:5342/ in browser, what commands output is very individual between commands.
Explained:
npx nx build scripts
cd dist/apps/scripts
USER=customoffice DATABASE_NAME=econ node main.js trigger-task-runner-job [queue_name] [job_name]
It is best to consult the code, to see the job to queue mapping. If you try to run a command, and you use the wrong queue, you will often get the error below in.
Error: Unknown job name: economicContactCreate at Worker.processFn (/Users/dhl/Repos/customoffice/dist/apps/task-runner/webpack:/src/tasks/index.ts:703:13) at Worker.callProcessJob (/Users/dhl/Repos/customoffice/node_modules/bullmq/src/classes/worker.ts:368:17) at /Users/dhl/Repos/customoffice/node_modules/bullmq/src/classes/worker.ts:878:37 at trace (/Users/dhl/Repos/customoffice/node_modules/bullmq/src/utils.ts:362:12) at Worker.trace (/Users/dhl/Repos/customoffice/node_modules/bullmq/src/classes/queue-base.ts:200:17) at Worker.processJob (/Users/dhl/Repos/customoffice/node_modules/bullmq/src/classes/worker.ts:847:17) at /Users/dhl/Repos/customoffice/node_modules/bullmq/src/classes/worker.ts:551:20 at Worker.retryIfFailed (/Users/dhl/Repos/customoffice/node_modules/bullmq/src/classes/worker.ts:1247:22) at Worker.mainLoop (/Users/dhl/Repos/customoffice/node_modules/bullmq/src/classes/worker.ts:549:16) at processTicksAndRejections (node:internal/process/task_queues:104:5)
Example:
npx nx build scripts
cd dist/apps/scripts
USER=customoffice DATABASE_NAME=econ node main.js trigger-task-runner-job sync economicContactCreate
If running the job in the example you should see in the logs below on http://127.0.0.1:5342/ in browser.
01 Jul 2026 12:31:47.984 job economicContactCreate completed
01 Jul 2026 12:31:47.966. job economicContactCreate started