Can not automatically start auth0 (shiny)

Dear

I have set up auth0 to run on my ubuntu server, where I have primarily shiny apps running on a shiny server.
If I manually trigger:

$ cd /home/<username>/shiny-auth0
$ node bin/www

the app runs as expected, having changed the proxy_pass & redirect to 3000 for auth0.

I have set

$ sudo nano /etc/systemd/system/shiny-auth0.service

so that the service should boot with the system.
But when I execute

$ sudo systemctl enable shiny-auth0
$ sudo systemctl start shiny-auth0

It just does not work.

I get the journal with
sudo journalctl -u shiny-auth0

and get the message:

– Logs begin at Tue 2020-08-11 19:13:00 UTC, end at Sun 2021-07-18 08:23:14 UTC. –
Jul 11 13:14:13 ip-172-31-47-49 systemd[1]: Started shiny-auth0.service.
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: Error: ENOENT: no such file or directory, open ‘.env’
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at Object.openSync (fs.js:462:3)
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at Object.readFileSync (fs.js:364:35)
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at Object.config (/home/ubuntu/shiny-auth0/node_modules/dotenv/l
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at Object. (/home/ubuntu/shiny-auth0/app.js:12:8)
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at Module._compile (internal/modules/cjs/loader.js:999:30)
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at Object.Module._extensions…js (internal/modules/cjs/loader.js
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at Module.load (internal/modules/cjs/loader.js:863:32)
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at Function.Module._load (internal/modules/cjs/loader.js:708:14)
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at Module.require (internal/modules/cjs/loader.js:887:19)
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at require (internal/modules/cjs/helpers.js:74:18) {
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: errno: -2,
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: syscall: ‘open’,
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: code: ‘ENOENT’,
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: path: ‘.env’
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: }
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: /home/ubuntu/shiny-auth0/node_modules/passport-auth0/lib/index.js:36
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: throw new Error('You must provide the ’ + k + ’ configuration
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: ^
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: Error: You must provide the domain configuration value to use passpo
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at /home/ubuntu/shiny-auth0/node_modules/passport-auth0/lib/inde

But I have the .env file configurated in
/home//shiny-auth0/

Do you know what I am missing?

Thanks!
Clemens

Hey @clemens.haerder any luck or solution to this ? Im facing the same issue.

Actually I just figured this out

If you run
$ sudo journalctl -u shiny-auth0

you should be able to see the error

It’s missing a WorkingDirectory directive in the shiny-auth0.service file

e.g

WorkingDirectory=/home/ubuntu/shinyapps/shiny-auth0

1 Like

Hey @wal thanks for the reply!
I am still facing the issue though, even by setting the working directory as you outlined in the .service file in
[Services]
WorkingDirectory=/home/ubuntu/shiny-auth0

ubuntu@ip-172-31-47-49:~$ sudo journalctl -u shiny-auth0
– Logs begin at Tue 2020-08-11 19:13:00 UTC, end at Sun 2021-08-01 07:17:33 UTC. –
Jul 11 13:14:13 ip-172-31-47-49 systemd[1]: Started shiny-auth0.service.
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: Error: ENOENT: no such file or directory, open ‘.env’
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at Object.openSync (fs.js:462:3)
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at Object.readFileSync (fs.js:364:35)
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at Object.config (/home/ubuntu/shiny-auth0/node_modules/dotenv/lib/main.js:30:37)
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at Object. (/home/ubuntu/shiny-auth0/app.js:12:8)
Jul 11 13:14:13 ip-172-31-47-49 ubuntu[20679]: at Module._compile (internal/modules/cjs/loader.js:999:30)

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.