UnraidUnraid

[7.3.1] Connect login loop from unraid-api socket path mismatch

Unraid OS Bug Reports5 months ago

Expected Behavior

After clicking Sign In with Unraid Connect, completing login at account.unraid.net, and clicking Register Server, the server should be registered and the Connect dropdown in the GUI header should reflect the signed-in state.

Actual Behavior

The browser is redirected back to the Unraid GUI login page. After logging back in, the Connect dropdown still shows Sign In — the server was never registered. The loop repeats indefinitely regardless of browser, session, or number of attempts.

The root cause is a one-line bug in .env.production. The PORT variable is defined with quoted value:

PORT="/var/run/unraid-api.sock"

The PM2 fork mode passes environment variables to the child process via the OS native env mechanism. In this process, the = from the PORT="..." assignment becomes an artefact in the socket filename created by the kernel. The result:

Socket created on disk:  /var/run/unraid-api.sock=   ← wrong (artefact of = from env line)
nginx expects:           /var/run/unraid-api.sock     ← does not exist → 502

The NestJS log is misleading — it reports the value after dotenv strips the quotes:

[21:49:18 INFO api]: Server listening on /var/run/unraid-api.sock

But the actual file on disk is /var/run/unraid-api.sock=. The bug is only detectable via direct filesystem inspection (ls -la /var/run/unraid-api*), not from the logs.

Because nginx cannot reach the API, all requests to /graphql/api/auth/oidc/callback return 502. The OIDC callback from account.unraid.net is never processed — server registration never completes.

The one-line fix:

# /usr/local/unraid-api/.env.production
# Change:
PORT="/var/run/unraid-api.sock"
# To:
PORT=/var/run/unraid-api.sock

Full cause chain:

.env.production:  PORT="/var/run/unraid-api.sock"   ← quoted value
        ↓
PM2 fork mode passes env to child process
        ↓
Socket created on disk: /var/run/unraid-api.sock=   ← = artefact from env assignment
        ↓
nginx proxies to: /var/run/unraid-api.sock          ← does not exist → 502
        ↓
OIDC callback returns 502 → login loop

Steps to Reproduce

  • Run Unraid 7.3.1 with unraid-api 4.35.0.

  • Install the Unraid Connect plugin.

  • Click Sign In in the GUI header.

  • Complete login at account.unraid.net and click Register Server.

  • Observe: browser returns to Unraid GUI login page. Server is not registered.

  • Confirm root cause:

# Socket has trailing =
ls -la /var/run/unraid-api*

# nginx points to path without =
grep -r "unraid-api" /etc/nginx/

# .env.production has quoted PORT value
cat /usr/local/unraid-api/.env.production

# Log reports path without = (misleading)
grep "listening on\|Starting Nest Server" /var/log/graphql-api.log | tail -5

Additional Context

  • Unraid OS: 7.3.1 (kernel 6.18.33-Unraid)

  • unraid-api: 4.35.0

  • License: Starter, USB key present, Internal Boot active

  • The standard forum workaround — unraid-api plugins install unraid-api-plugin-connect — does not resolve the issue on 4.35.0 and causes secondary damage: the plugin is registered momentarily but is cleared on the immediate restart the command triggers. The Connect button disappears from the GUI header and cannot be restored through any subsequent method. The Connect button was present before attempting this workaround.

  • Downgrade to 7.2.x is not possible: Internal Boot + TPM licensing are active.

  • Multiple users report the same login loop on 7.3.1 (forum topic 199355, opened 2026-06-09). The quoted PORT value as root cause has not been publicly documented before this report.

  • This continues a pattern of Connect/nginx regressions with each OS minor release: 7.2.4 introduced bootstrapNestServer timed out (forum topic 197998, GitHub issue #1989).

Workarounds

None persistent. The following restores the socket temporarily but is wiped on every API restart:

# Temporary only — does not survive restart
ln -s "/var/run/unraid-api.sock=" /var/run/unraid-api.sock

The permanent fix requires changing one line in .env.production (remove quotes from PORT value) and restarting the API. This file is part of the installed package and would be overwritten on next update — the fix belongs in the source.

Screenshots / Videos / Diagnostics

root@RSCloud:~# ls -la /var/run/unraid-api*
-rw-r--r-- 1 root root  5 Jun 12 20:38 /var/run/unraid-api-restart.lock
srwxrwxrwx 1 root root  0 Jun 12 21:49 /var/run/unraid-api.sock=

/var/run/unraid-api:
total 4
drwxr-xr-x  2 root root   60 Jun 12 20:36 ./
drwxr-xr-x 20 root root 1020 Jun 12 22:08 ../
-rw-------  1 root root   64 Jun 12 22:12 local-session
root@RSCloud:~# grep -r "unraid-api" /etc/nginx/
/etc/nginx/conf.d/locations.conf:    proxy_pass http://unix:/var/run/unraid-api.sock:/graphql;
root@RSCloud:~# unraid-api plugins list
No plugins installed.

root@RSCloud:~# grep "listening on\|Starting Nest Server" /var/log/graphql-api.log | tail -5
[21:33:36 INFO api]: Server listening on /var/run/unraid-api.sock {"apiVersion":"4.35.0+264ddf00","logger":"api"}
[21:41:39 INFO api]: Starting Nest Server on Port / Path: /var/run/unraid-api.sock {"apiVersion":"4.35.0+264ddf00","logger":"api"}
[21:41:39 INFO api]: Server listening on /var/run/unraid-api.sock {"apiVersion":"4.35.0+264ddf00","logger":"api"}
[21:49:18 INFO api]: Starting Nest Server on Port / Path: /var/run/unraid-api.sock {"apiVersion":"4.35.0+264ddf00","logger":"api"}
[21:49:18 INFO api]: Server listening on /var/run/unraid-api.sock {"apiVersion":"4.35.0+264ddf00","logger":"api"}

root@RSCloud:~# cat /usr/local/unraid-api/.env.production
ENVIRONMENT="production"
NODE_ENV="production"
PORT="/var/run/unraid-api.sock"
MOTHERSHIP_GRAPHQL_LINK="https://mothership.unraid.net/ws"
PATHS_CONFIG_MODULES="/boot/config/plugins/dynamix.my.servers/configs"
ENABLE_NEXT_DOCKER_RELEASE=true

  1. In Review
  2. Planned
  3. In Progress
  4. Completed
Loading content, please wait...
Loading content, please wait...
Loading content, please wait...
Loading content, please wait...
Loading content, please wait...
Loading content, please wait...
Loading content, please wait...
Loading content, please wait...
Loading content, please wait...
Loading content, please wait...
Loading content, please wait...
Loading content, please wait...