I have a chatbot application that should run as a service with systemctl. Whenever I try to start the chatbot service I’m getting error and the service fails.
If I start the chatbot directly from the terminal it works fine. But not when I start it as a service.
My issue is that I don't know if it's the chatbot fault or the service fault.
Loaded: loaded (/etc/systemd/system/chatbot.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-08-27 09:44:01 CEST; 5s ago
Process: 9634 ExecStart=/home/chatbot_eng/chatbot/bp (code=exited, status=1/FAILURE)
Main PID: 9634 (code=exited, status=1/FAILURE)
Aug 27 09:44:01 s2.test.com bp[9634]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:711:10)
Aug 27 09:44:01 s2.test.com bp[9634]: at Module.load (internal/modules/cjs/loader.js:610:32)
Aug 27 09:44:01 s2.test.com bp[9634]: at tryModuleLoad (internal/modules/cjs/loader.js:549:12)
Aug 27 09:44:01 s2.test.com bp[9634]: at Function.Module._load (internal/modules/cjs/loader.js:541:3)
Aug 27 09:44:01 s2.test.com bp[9634]: at Function.Module.runMain (pkg/prelude/bootstrap.js:1309:12)
Aug 27 09:44:01 s2.test.com bp[9634]: at startup (internal/bootstrap/node.js:274:19)
Aug 27 09:44:01 s2.test.com bp[9634]: at bootstrapNodeJSCore (internal/bootstrap/node.js:608:3)
Aug 27 09:44:01 s2.test.com systemd[1]: chatbot.service: Main process exited, code=exited, status=1/FAILURE
Aug 27 09:44:01 s2.test.com systemd[1]: chatbot.service: Unit entered failed state.
Aug 27 09:44:01 s2.test.com systemd[1]: chatbot.service: Failed with result 'exit-code'.
When I execute journalctl with the process ID, I’m getting:
Aug 27 09:44:01 s2.test.com bp[9634]: path.js:39
Aug 27 09:44:01 s2.test.com bp[9634]: throw new ERR_INVALID_ARG_TYPE('path', 'string', path);
Aug 27 09:44:01 s2.test.com bp[9634]: ^
Aug 27 09:44:01 s2.test.com bp[9634]: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
Aug 27 09:44:01 s2.test.com bp[9634]: at assertPath (path.js:39:11)
Aug 27 09:44:01 s2.test.com bp[9634]: at Object.join (path.js:1157:7)
Aug 27 09:44:01 s2.test.com bp[9634]: at getAppDataPath (/snapshot/build-linux/out/bp/core/misc/app_data.js:0:0)
Aug 27 09:44:01 s2.test.com bp[9634]: at Object.<anonymous> (/snapshot/build-linux/out/bp/index.js:0:0)
Aug 27 09:44:01 s2.test.com bp[9634]: at Module._compile (pkg/prelude/bootstrap.js:1254:22)
Aug 27 09:44:01 s2.test.com bp[9634]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:711:10)
Aug 27 09:44:01 s2.test.com bp[9634]: at Module.load (internal/modules/cjs/loader.js:610:32)
Aug 27 09:44:01 s2.test.com bp[9634]: at tryModuleLoad (internal/modules/cjs/loader.js:549:12)
Aug 27 09:44:01 s2.test.com bp[9634]: at Function.Module._load (internal/modules/cjs/loader.js:541:3)
Aug 27 09:44:01 s2.test.com bp[9634]: at Function.Module.runMain (pkg/prelude/bootstrap.js:1309:12)
Aug 27 09:44:01 s2.test.com bp[9634]: at startup (internal/bootstrap/node.js:274:19)
Aug 27 09:44:01 s2.test.com bp[9634]: at bootstrapNodeJSCore (internal/bootstrap/node.js:608:3)
This is my service:
[Unit]
Description=Chatbot
[Service]
ExecStart=/home/chatbot_eng/chatbot/bp
[Install]
WantedBy=multi-user.target