A script that works in your shell and fails as a service is very often an environment problem. Services do not read .bashrc or /etc/profile; they start from the block the service manager hands out.
Print that block:
systemctl show-environment
On a fresh Ubuntu container it holds little more than LANG=C.UTF-8 and a short PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin. So a tool installed in ~/.local/bin or /opt/something/bin is simply not found, and anything you exported in your profile, like a proxy or an API endpoint, is missing too.
The man page notes that per unit settings are not included. Environment= and EnvironmentFile= lines come on top of this block, so check those with systemctl show myapp -p Environment.
You can change the block at runtime:
sudo systemctl set-environment HTTPS_PROXY=http://proxy.example.com:3128
sudo systemctl unset-environment HTTPS_PROXY
The variable shows up in show-environment right after the first command and is gone after the second. Services started after that inherit it.
I would not use set-environment as a fix, though. It is lost at reboot and affects every service at once. Put what one service needs in its own unit with Environment=, and use full paths in ExecStart=.
Further reading: systemctl man page