Unable to connect to the User Interface on port 4000

1,573 views
Skip to first unread message

Night Librarian

unread,
Sep 1, 2022, 2:05:59 AM9/1/22
to DSpace Technical Support
Greetings!

I installed DSpace 7.2 on Ubuntu 20.04 and migrated the database and the assetstore. Backend installed fine, HAL browser shows the contents correctly, SOLR is running. 

Followed the Frontend installation instructions. Now, "pm start dspace-ui.json" output shows that dspace-ui is online.   http://localhost:8080/server/api has 3 tabs, the first one, JSON, shows dspaceUI as "http://localhost:4000", and dspaceServer as "http://localhost:8080/server". 

lsof -i:4000 shows:

COMMAND node\x20
PID                16129
USER             dspace
FD                  20u
TYPE              IPv4
DEVICE          188128
SIZE/OFF       0t0
NODE             TCP
NAME            localhost:4000 (LISTEN)

However, when I try to go to http://localhost:4000, the browser says "Unable to connect".

I followed the instructions at https://wiki.lyrasis.org/display/DSPACE/Troubleshoot+an+error#Troubleshootanerror-FindingtheErrorMessageintheUserInterface(Trythisfirst!) and reproduced the problem in Chrome and Firefox with similar results.

In Chrome, Console shows:

VM487:6792 crbug/1173575, non-JS module files deprecated.
(anonymous) @ VM487:6792


Network -> Headers shows:

Request URL:
http://localhost:4000/
Referrer Policy:strict-origin-when-cross-origin
Request Headers
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding:gzip, deflate, br
Accept-Language:en-US,en;q=0.9
Cache-Control:max-age=0
Connection:keep-alive
Host:localhost:4000
sec-ch-ua:"Google Chrome";v="105", "Not)A;Brand";v="8", "Chromium";v="105"
sec-ch-ua-mobile:?0
sec-ch-ua-platform:"Linux"
Sec-Fetch-Dest:document
Sec-Fetch-Mode:navigate
Sec-Fetch-Site:none
Sec-Fetch-User:?1
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

while Network -> Response only says:

Failed to load response data: No  resource with given identifier found

What am I missing?

George Yusto

unread,
Sep 2, 2022, 4:14:07 AM9/2/22
to Night Librarian, DSpace Technical Support
Your backend must use ssl... (https*)

--
All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
---
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/4da33458-5e1c-4b05-86d5-7f8cd91d678cn%40googlegroups.com.

Tim Donohue

unread,
Sep 2, 2022, 10:14:37 AM9/2/22
to DSpace Technical Support
The backend does need to use SSL (HTTPS) if you plan on accessing it from a different machine.  However, it is possible to run both the frontend & backend on HTTP, provided that you only use localhost URLs & you only access the site from the same machine where it is running (as this is a normal development setup).

It's unclear from the errors you shared whether you are attempting to access the site from the same machine it's running on, or not.

The basic issue though seems to imply that the UI is not running at all (if you don't even see a loading screen or a blank screen or anything, that means the UI is not running at all).  This would likely imply that something is incorrect in your PM2 setup or the UI configuration (config.*.yml).  

You could try running the UI temporarily via "yarn start" just to see if it starts up properly that way.  If it does, then your PM2 configuration may require updates.  If it does not, then it's more likely your config.*.yml needs fixes (and you may see some more descriptive error messages)

Tim

Night Librarian

unread,
Sep 3, 2022, 2:20:29 PM9/3/22
to DSpace Technical Support
Thank you, Tim.

I am accessing the server on localhost, which is on my development virtual machine.  I added the following to dspace-ui.json:

        "DSPACE_REST_SSL": "false",
        "DSPACE_REST_HOST": "localhost",
        "DSPACE_REST_PORT": "4000",
        "DSPACE_REST_NAMESPACE": "/server"

and the UI is now showing in the browser just fine:

sudo pm2 start dspace-ui.json
[PM2][WARN] Applications dspace-ui not running, starting...
[PM2] App [dspace-ui] launched (1 instances)
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0  │ dspace-ui          │ fork     │ 0    │ online    │ 0%       │ 23.9mb   │

Night Librarian

unread,
Sep 5, 2022, 10:26:10 PM9/5/22
to DSpace Technical Support
Then again, I  believe I made an error in dspace-ui.json, because I had trouble stopping and starting pm2 after I posted the previous message. When I would issue sudo pm2 stop dspace-ui.json, it would show me dspace-ui status as "stopped" and I couldn't access the frontend in the browser.  However, I couldn't start pm2 again, seeing the following error as part of pm2 logs:

0|dspace-u |   code: 'EADDRINUSE',
0|dspace-u |   errno: -98,
0|dspace-u |   syscall: 'listen',
0|dspace-u |   address: '127.0.0.1',
0|dspace-u |   port: 4000

and when I ran sudo lsof -i tcp:4000, I would see dozens of processes, looking like this:

node\x20/ 520790 root 19u IPv4 3040271 0t0 TCP localhost:4000->localhost:44452 (ESTABLISHED)
node\x20/ 520790 root 20u IPv4 3040252 0t0 TCP localhost:4000 (LISTEN)
node\x20/ 520790 root 19u IPv4 3040274 0t0 TCP localhost:44454->localhost:4000 (ESTABLISHED)
node\x20/ 520790 root 19u IPv4 3040275 0t0 TCP localhost:4000->localhost:44454 (ESTABLISHED)
node\x20/ 520790 root 19u IPv4 3040278 0t0 TCP localhost:44456->localhost:4000 (ESTABLISHED)
node\x20/ 520790 root 19u IPv4 3040279 0t0 TCP localhost:4000->localhost:44456 (ESTABLISHED)
<...>

Then, by happenstance, I compared the entries in my config.prod.yml and dspace-ui.json and noticed that I had in dspace-ui.json:

"DSPACE_REST_PORT":  "4000",

while it should be 8080.  Changed it to 8080 and now starting and stopping dspace-ui.json goes well, no new errors in pm2 logs and the UI works well.



Reply all
Reply to author
Forward
0 new messages